changeset 10550:522cd02f235f

[gaim-migrate @ 11924] This should fix the annoying problem of the docked buddy list stealing screen real estate when it is hidden. Turns out it was actually using the section of the screen, you just couldn't see it. I think this is the last of the bugs that I introduced into the docking stuff. committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Fri, 28 Jan 2005 05:01:24 +0000
parents 8bc7ba019e96
children 6ef7be688140
files plugins/win32/winprefs/gtkappbar.c plugins/win32/winprefs/gtkappbar.h
diffstat 2 files changed, 51 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/win32/winprefs/gtkappbar.c	Thu Jan 27 05:28:08 2005 +0000
+++ b/plugins/win32/winprefs/gtkappbar.c	Fri Jan 28 05:01:24 2005 +0000
@@ -154,6 +154,7 @@
                    rc->left, rc->right, rc->top, rc->bottom);
 }
 #endif
+/** Set the window style to be the "Tool Window" style - small header, no min/max buttons */
 static void set_toolbar(HWND hwnd, gboolean val) {
 	LONG style=0;
 
@@ -173,7 +174,7 @@
  *			SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); 
  */
 }
-
+/** Register the window as an appbar */
 static gboolean gtk_appbar_register(GtkAppBar *ab, HWND hwnd) {
 	APPBARDATA abd;
 
@@ -185,7 +186,7 @@
 
 	return ab->registered;
 }
-
+/** Unregister the window as an appbar */
 static gboolean gtk_appbar_unregister(GtkAppBar *ab, HWND hwnd) {
 	APPBARDATA abd;
 
@@ -195,13 +196,14 @@
 	abd.cbSize = sizeof(APPBARDATA);
 	abd.hWnd = hwnd;
 
-	ab->registered = !SHAppBarMessage(ABM_REMOVE, &abd);
+	SHAppBarMessage(ABM_REMOVE, &abd); /** This always returns TRUE */
+
+	ab->registered = FALSE;
 
-        if(!ab->registered) {
-                ab->docked = FALSE;
-                ab->docking = FALSE;
-        }
-	return !ab->registered;
+	ab->docked = FALSE;
+	ab->docking = FALSE;
+
+	return TRUE;
 }
 
 static void gtk_appbar_querypos(GtkAppBar *ab, HWND hwnd, RECT rcWorkspace) {
@@ -248,7 +250,7 @@
 
 	CopyRect(&(ab->docked_rect), &abd.rc);
 }
-
+/* Actually set the size and screen location of the appbar */
 static void gtk_appbar_setpos(GtkAppBar *ab, HWND hwnd) {
         APPBARDATA abd;
 
@@ -262,7 +264,7 @@
 
 	SHAppBarMessage(ABM_SETPOS, &abd);
 }
-
+/** Let any callbacks know that we have docked or undocked */
 static void gtk_appbar_dispatch_dock_cbs(GtkAppBar *ab, gboolean val) {
         GList *lst = ab->dock_cbs;
 
@@ -341,31 +343,35 @@
         }
         return GDK_FILTER_CONTINUE;
 }
+/** Notify the system that the appbar has been activated */
+static GdkFilterReturn wnd_activate(GtkAppBar *ab, GdkXEvent *xevent) {
+	if (ab->registered) {
+		APPBARDATA abd;
+		MSG *msg = (MSG*)xevent;
+		gaim_debug(GAIM_DEBUG_INFO, "gtkappbar", "wnd_activate\n");
 
-static GdkFilterReturn wnd_activate(GdkXEvent *xevent) {
-	APPBARDATA abd;
-	MSG *msg = (MSG*)xevent;
-	gaim_debug(GAIM_DEBUG_INFO, "gtkappbar", "wnd_activate\n");
+		abd.hWnd = msg->hwnd;
+		abd.cbSize = sizeof(APPBARDATA);
 
-	abd.hWnd = msg->hwnd;
-	abd.cbSize = sizeof(APPBARDATA);
-
-	SHAppBarMessage(ABM_ACTIVATE, &abd);
+		SHAppBarMessage(ABM_ACTIVATE, &abd);
+	}
 	return GDK_FILTER_CONTINUE;
 }
+/** 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;
+		gaim_debug(GAIM_DEBUG_INFO, "gtkappbar", "wnd_poschanged\n");
 
-static GdkFilterReturn wnd_poschanged(GdkXEvent *xevent) {
-	APPBARDATA abd;
-	MSG *msg = (MSG*)xevent;
-	gaim_debug(GAIM_DEBUG_INFO, "gtkappbar", "wnd_poschanged\n");
+		abd.hWnd = msg->hwnd;
+		abd.cbSize = sizeof(APPBARDATA);
 
-	abd.hWnd = msg->hwnd;
-	abd.cbSize = sizeof(APPBARDATA);
-
-	SHAppBarMessage(ABM_WINDOWPOSCHANGED, &abd);
+		SHAppBarMessage(ABM_WINDOWPOSCHANGED, &abd);
+	}
 	return GDK_FILTER_CONTINUE;
 }
-
+/** The window is about to change */
 static GdkFilterReturn wnd_poschanging(GtkAppBar *ab, GdkXEvent *xevent) {
         MSG *msg = (MSG*)xevent;
         WINDOWPOS *wpos = (WINDOWPOS*)msg->lParam;
@@ -387,6 +393,7 @@
 static GdkFilterReturn wnd_exitsizemove(GtkAppBar *ab, GdkXEvent *xevent) {
         MSG *msg = (MSG*)xevent;
 
+        gaim_debug(GAIM_DEBUG_INFO, "gtkappbar", "wnd_exitsizemove\n");
         if(ab->docking) {
                 gtk_appbar_setpos(ab, msg->hwnd);
                 ab->docking = FALSE;
@@ -406,20 +413,21 @@
 
         gaim_debug(GAIM_DEBUG_INFO, "gtkappbar", "wnd_showwindow\n");
         if(msg->wParam && ab->docked) {
+		ab->iconized = FALSE;
                 gaim_debug(GAIM_DEBUG_INFO, "gtkappbar", "shown\n");
                 ab->docked = FALSE;
                 gtk_appbar_dock(ab, ab->side);
-                
         }
         else if(!msg->wParam && ab->docked) {
                 gaim_debug(GAIM_DEBUG_INFO, "gtkappbar", "hidden\n");
                 gtk_appbar_unregister(ab, GDK_WINDOW_HWND(ab->win->window));
                 set_toolbar(GDK_WINDOW_HWND(ab->win->window), FALSE);
                 ab->docked = TRUE;
+		ab->iconized = TRUE;
         }
         return GDK_FILTER_CONTINUE;
 }
-
+/** The window's size has changed */
 static GdkFilterReturn wnd_size(GtkAppBar *ab, GdkXEvent *xevent) {
         MSG *msg = (MSG*)xevent;
 
@@ -434,7 +442,7 @@
         }
         else if(msg->wParam == SIZE_RESTORED) {
                 gaim_debug(GAIM_DEBUG_INFO, "gtkappbar", "Restore\n");
-                if(ab->docked) {
+		if (!ab->iconized && ab->docked) {
                         gtk_appbar_dock(ab, ab->side);
                 }
         }
@@ -498,6 +506,7 @@
 
         case ABN_FULLSCREENAPP:
                 gaim_debug(GAIM_DEBUG_INFO, "gtkappbar", "gtk_appbar_callback: ABN_FULLSCREENAPP: %d\n", (BOOL)msg->lParam);
+		if (!ab->iconized && ab->docked) {
 		if ((BOOL)msg->lParam) {
 			SetWindowPos(msg->hwnd, HWND_BOTTOM, 0, 0, 0, 0,
 				SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
@@ -505,6 +514,7 @@
 			SetWindowPos(msg->hwnd, HWND_NOTOPMOST, 0, 0, 0, 0,
 				SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_FRAMECHANGED);
 		}
+		}
 
                 break;
         
@@ -537,9 +547,9 @@
         case WM_WINDOWPOSCHANGING:
                 return wnd_poschanging(data, xevent);
 	case WM_WINDOWPOSCHANGED:
-		return wnd_poschanged(xevent);
+		return wnd_poschanged(data, xevent);
 	case WM_ACTIVATE:
-		return wnd_activate(xevent);
+		return wnd_activate(data, xevent);
         case WM_SIZING:
                 return wnd_sizing(data, xevent);
         case WM_MOVING:
--- a/plugins/win32/winprefs/gtkappbar.h	Thu Jan 27 05:28:08 2005 +0000
+++ b/plugins/win32/winprefs/gtkappbar.h	Fri Jan 28 05:01:24 2005 +0000
@@ -27,13 +27,22 @@
 
 typedef struct {
         GtkWidget *win;
+	/** The rectangle of the screen area used for docking */
         RECT docked_rect;
+	/** The height of the window prior to docking */
         UINT undocked_height;
+	/** The side of the screen to which the window is docked*/
         UINT side;
+	/** Is the window currently docked? */
         gboolean docked;
+	/** Is the window currently in the process of docking? */
         gboolean docking;
+	/** Is the window currently registered as an appbar */
         gboolean registered;
+	/** Callback functions to notify of dock state change */
         GList *dock_cbs;
+	/** Is the window currently iconized? */
+	gboolean iconized;
 } GtkAppBar;
 
 typedef void (*GtkAppBarDockCB)(gboolean);