comparison src/buddy.c @ 3939:49d42b275a68

[gaim-migrate @ 4115] .todo file spelling fixes. (22:11:39) Robot101: Fixes bug with multiple consecutive docklet clicks not correctly showing and hiding the blist (22:12:26) Robot101: Fixes compile warning in docklet.c the correct way (without adding a default to the switch on an enum) (22:12:53) Robot101: Avoids the blist being moved off-screen by the position remembering code, and does the move before showing it instead of after (22:13:50) Robot101: Fix evil behaviour with disappearing blists when you switch desktop or minimise by removing the silly code (22:14:24) Robot101: Replace it with nice code that raises the blist when you click the docklet if it's fully obscured committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Mon, 11 Nov 2002 03:18:00 +0000
parents 22ed8423a964
children 40258b6b5ecf
comparison
equal deleted inserted replaced
3938:5e390f6f8efc 3939:49d42b275a68
99 char *name; 99 char *name;
100 }; 100 };
101 static GSList *shows = NULL; 101 static GSList *shows = NULL;
102 102
103 int docklet_count = 0; 103 int docklet_count = 0;
104 static gboolean obscured = FALSE;
104 105
105 /* Predefine some functions */ 106 /* Predefine some functions */
106 static void new_bp_callback(GtkWidget *w, struct buddy *bs); 107 static void new_bp_callback(GtkWidget *w, struct buddy *bs);
107 static struct group_show *find_group_show(char *group); 108 static struct group_show *find_group_show(char *group);
108 static struct buddy_show *find_buddy_show(struct group_show *gs, char *name); 109 static struct buddy_show *find_buddy_show(struct group_show *gs, char *name);
2019 } 2020 }
2020 2021
2021 /* mostly used by code in this file */ 2022 /* mostly used by code in this file */
2022 void unhide_buddy_list() { 2023 void unhide_buddy_list() {
2023 if (blist) { 2024 if (blist) {
2024 gtk_window_present(GTK_WINDOW(blist));
2025 if (blist_options & OPT_BLIST_SAVED_WINDOWS && blist_pos.width != 0) { 2025 if (blist_options & OPT_BLIST_SAVED_WINDOWS && blist_pos.width != 0) {
2026 /* don't move it off screen */
2027 if (blist_pos.x >= gdk_screen_width()) {
2028 blist_pos.x = gdk_screen_width() - 100;
2029 } else if (blist_pos.x <= 0) {
2030 blist_pos.x = 100;
2031 }
2032
2033 if (blist_pos.y >= gdk_screen_height()) {
2034 blist_pos.y = gdk_screen_height() - 100;
2035 } else if (blist_pos.y <= 0) {
2036 blist_pos.y = 100;
2037 }
2038
2026 gtk_window_move(GTK_WINDOW(blist), blist_pos.x, blist_pos.y); 2039 gtk_window_move(GTK_WINDOW(blist), blist_pos.x, blist_pos.y);
2027 gtk_window_resize(GTK_WINDOW(blist), blist_pos.width, blist_pos.height); 2040 gtk_window_resize(GTK_WINDOW(blist), blist_pos.width, blist_pos.height);
2028 } 2041 }
2042
2043 gtk_window_present(GTK_WINDOW(blist));
2029 } 2044 }
2030 } 2045 }
2031 2046
2032 /* for the delete_event handler */ 2047 /* for the delete_event handler */
2033 static void close_buddy_list() { 2048 static void close_buddy_list() {
2059 /* Useful for the docklet plugin and also for the win32 tray icon*/ 2074 /* Useful for the docklet plugin and also for the win32 tray icon*/
2060 /* This is called when one of those is clicked--it will show/hide the 2075 /* This is called when one of those is clicked--it will show/hide the
2061 buddy list/login window--depending on which is active */ 2076 buddy list/login window--depending on which is active */
2062 if (connections && blist) { 2077 if (connections && blist) {
2063 if (GTK_WIDGET_VISIBLE(blist)) { 2078 if (GTK_WIDGET_VISIBLE(blist)) {
2064 if (GAIM_WINDOW_ICONIFIED(blist)) { 2079 if (GAIM_WINDOW_ICONIFIED(blist) || obscured) {
2065 unhide_buddy_list(); 2080 unhide_buddy_list();
2066 } else { 2081 } else {
2067 hide_buddy_list(); 2082 hide_buddy_list();
2068 } 2083 }
2069 } else { 2084 } else {
2470 blist_pos.height = event->height; 2485 blist_pos.height = event->height;
2471 save_prefs(); 2486 save_prefs();
2472 } 2487 }
2473 } 2488 }
2474 2489
2475 static void change_state_blist_window(GtkWidget *w, GdkEventWindowState *event, void *dummy) { 2490 static void visibility_blist_window(GtkWidget *w, GdkEventVisibility *event, void *data) {
2476 if (event->new_window_state & GDK_WINDOW_STATE_ICONIFIED && 2491 if (event->state == GDK_VISIBILITY_FULLY_OBSCURED) {
2477 docklet_count) { 2492 obscured = TRUE;
2478 gtk_widget_hide(blist); 2493 } else {
2494 obscured = FALSE;
2479 } 2495 }
2480 } 2496 }
2481 2497
2482 /******************************************************************* 2498 /*******************************************************************
2483 * 2499 *
2783 gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0); 2799 gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0);
2784 gtk_container_add(GTK_CONTAINER(blist), vbox); 2800 gtk_container_add(GTK_CONTAINER(blist), vbox);
2785 2801
2786 g_signal_connect(G_OBJECT(blist), "delete_event", G_CALLBACK(close_buddy_list), NULL); 2802 g_signal_connect(G_OBJECT(blist), "delete_event", G_CALLBACK(close_buddy_list), NULL);
2787 g_signal_connect(G_OBJECT(blist), "configure_event", G_CALLBACK(configure_blist_window), NULL); 2803 g_signal_connect(G_OBJECT(blist), "configure_event", G_CALLBACK(configure_blist_window), NULL);
2788 g_signal_connect(G_OBJECT(blist), "window_state_event", G_CALLBACK(change_state_blist_window), NULL); 2804 g_signal_connect(G_OBJECT(blist), "visibility_notify_event", G_CALLBACK(visibility_blist_window), NULL);
2805
2806 gtk_widget_add_events(blist, GDK_VISIBILITY_NOTIFY_MASK);
2789 2807
2790 /* The edit tree */ 2808 /* The edit tree */
2791 gtk_container_add(GTK_CONTAINER(tbox), edittree); 2809 gtk_container_add(GTK_CONTAINER(tbox), edittree);
2792 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(tbox), 2810 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(tbox),
2793 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); 2811 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);