changeset 20769:712020cd7c8e

Undock/Redock the buddy list based on the SWP_SHOWWINDOW and SWP_HIDEWINDOW attributes in a WM_WINDOWPOSCHANGING message. This doesn't appear to have any negative effects and makes Pidgin play nicer with the VirtuaWin virtual desktop manager. Fixes #2997.
author Daniel Atallah <daniel.atallah@gmail.com>
date Thu, 04 Oct 2007 01:25:43 +0000
parents 48ee7ec3426d
children d1e8f4d63f01
files pidgin/plugins/win32/winprefs/gtkappbar.c
diffstat 1 files changed, 37 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/plugins/win32/winprefs/gtkappbar.c	Thu Oct 04 01:12:08 2007 +0000
+++ b/pidgin/plugins/win32/winprefs/gtkappbar.c	Thu Oct 04 01:25:43 2007 +0000
@@ -352,17 +352,37 @@
 	}
 	return GDK_FILTER_CONTINUE;
 }
+
+static void show_hide(GtkAppBar *ab, gboolean hide) {
+	purple_debug_info("gtkappbar", "show_hide(%d)\n", hide);
+
+	if (hide) {
+		purple_debug_info("gtkappbar", "hidden\n");
+		gtk_appbar_unregister(ab, GDK_WINDOW_HWND(ab->win->window));
+		ab->docked = TRUE;
+		ab->iconized = TRUE;
+	} else {
+		ab->iconized = FALSE;
+		purple_debug_info("gtkappbar", "shown\n");
+		ab->docked = FALSE;
+		gtk_appbar_do_dock(ab, ab->side);
+	}
+
+}
+
 /** Notify the system that the appbar's position has changed */
 static GdkFilterReturn wnd_poschanged(GtkAppBar *ab, GdkXEvent *xevent) {
 	if (ab->registered) {
 		APPBARDATA abd;
 		MSG *msg = (MSG*)xevent;
+
 		purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "wnd_poschanged\n");
 
 		abd.hWnd = msg->hwnd;
 		abd.cbSize = sizeof(APPBARDATA);
 
 		SHAppBarMessage(ABM_WINDOWPOSCHANGED, &abd);
+
 	}
 	return GDK_FILTER_CONTINUE;
 }
@@ -382,6 +402,14 @@
                         set_toolbar(msg->hwnd, FALSE);
                 /*return GDK_FILTER_REMOVE;*/
         }
+
+	if (ab->docked) {
+		if (ab->iconized && wpos->flags & SWP_SHOWWINDOW)
+			show_hide(ab, FALSE);
+		else if (!ab->iconized && wpos->flags & SWP_HIDEWINDOW)
+			show_hide(ab, TRUE);
+	}
+
         return GDK_FILTER_CONTINUE;
 }
 
@@ -409,23 +437,17 @@
 }
 
 static GdkFilterReturn wnd_showwindow(GtkAppBar *ab, GdkXEvent *xevent) {
-        MSG *msg = (MSG*)xevent;
+	MSG *msg = (MSG*)xevent;
 
-        purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "wnd_showwindow\n");
-        if(msg->wParam && ab->docked) {
-		ab->iconized = FALSE;
-                purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "shown\n");
-                ab->docked = FALSE;
-                gtk_appbar_do_dock(ab, ab->side);
-        }
-        else if(!msg->wParam && ab->docked) {
-                purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "hidden\n");
-                gtk_appbar_unregister(ab, GDK_WINDOW_HWND(ab->win->window));
-                ab->docked = TRUE;
-		ab->iconized = TRUE;
-        }
-        return GDK_FILTER_CONTINUE;
+	purple_debug_info("gtkappbar", "wnd_showwindow\n");
+	if(msg->wParam && ab->docked) {
+		show_hide(ab, FALSE);
+	} else if(!msg->wParam && ab->docked) {
+		show_hide(ab, TRUE);
+	}
+	return GDK_FILTER_CONTINUE;
 }
+
 /** The window's size has changed */
 static GdkFilterReturn wnd_size(GtkAppBar *ab, GdkXEvent *xevent) {
         MSG *msg = (MSG*)xevent;