pidgin/plugins/win32/winprefs/gtkappbar.c

Wed, 21 Sep 2011 06:45:26 +0000

author
Elliott Sales de Andrade <qulogic@pidgin.im>
date
Wed, 21 Sep 2011 06:45:26 +0000
changeset 32575
eb4fc932fae9
parent 31294
73607ab89c6f
child 35896
bfee243ed8b1
permissions
-rw-r--r--

Apply conversation theme when opening the GTK conversation. All the
parsing stuff was moved out of the theme code and into the conversation
code.

Someone (not me!) needs to check the code I commented out and see if
we really need that stuff (and then port it to WebKit/styling).

We also need to determine where to place Template.html and the rest
of our (not-yet-written) default theme.

14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
1 /*
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
2 * purple - WinPurple Options Plugin
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
3 *
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
4 * File: gtkappbar.c
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
5 * Date: August 2, 2003
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
6 * Description: Appbar functionality for Windows GTK+ applications
15697
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
7 *
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
8 * Copyright (C) 2003, Herman Bloggs <hermanator12002@yahoo.com>
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
9 *
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
10 * This program is free software; you can redistribute it and/or modify
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
11 * it under the terms of the GNU General Public License as published by
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
12 * the Free Software Foundation; either version 2 of the License, or
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
13 * (at your option) any later version.
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
14 *
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
15 * This program is distributed in the hope that it will be useful,
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
18 * GNU General Public License for more details.
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
19 *
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
20 * You should have received a copy of the GNU General Public License
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
21 * along with this program; if not, write to the Free Software
19859
71d37b57eff2 The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19395
diff changeset
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
23 *
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
24 */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
25 /*
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
26 * TODO:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
27 * - Move 'App on top' feature from Trans plugin to here
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
28 * - Bug: Multiple Show/Hide Desktop calls causes client area to disappear
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
29 */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
30 #include <windows.h>
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
31 #include <winver.h>
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
32 #include <stdio.h>
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
33 #include <gtk/gtk.h>
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
34 #include <gdk/gdkwin32.h>
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
35 #include "gtkappbar.h"
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
36 #include "debug.h"
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
37
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
38 #define APPBAR_CALLBACK WM_USER + 1010
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
39
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
40 typedef HMONITOR WINAPI purple_MonitorFromPoint(POINT, DWORD);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
41 typedef HMONITOR WINAPI purple_MonitorFromWindow(HWND, DWORD);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
42 typedef BOOL WINAPI purple_GetMonitorInfo(HMONITOR, LPMONITORINFO);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
43
19395
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
44 static void gtk_appbar_do_dock(GtkAppBar *ab, UINT side);
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
45
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
46 /* Retrieve the rectangular display area from the specified monitor
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
47 * Return TRUE if successful, otherwise FALSE
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
48 */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
49 static gboolean
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
50 get_rect_from_monitor(HMODULE hmod, HMONITOR monitor, RECT *rect) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
51 purple_GetMonitorInfo *the_GetMonitorInfo;
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
52 MONITORINFO info;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
53
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
54 if (!(the_GetMonitorInfo = (purple_GetMonitorInfo*)
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
55 GetProcAddress(hmod, "GetMonitorInfoA"))) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
56 return FALSE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
57 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
58
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
59 info.cbSize = sizeof(info);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
60 if (!the_GetMonitorInfo(monitor, &info)) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
61 return FALSE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
62 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
63
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
64 CopyRect(rect, &(info.rcMonitor));
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
65
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
66 return TRUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
67 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
68
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
69 /**
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
70 * This will only work on Win98+ and Win2K+
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
71 * Return TRUE if successful, otherwise FALSE
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
72 */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
73 static gboolean
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
74 get_rect_at_point_multimonitor(POINT pt, RECT *rect) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
75 HMODULE hmod;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
76 purple_MonitorFromPoint *the_MonitorFromPoint;
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
77 HMONITOR monitor;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
78
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
79 if (!(hmod = GetModuleHandle("user32"))) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
80 return FALSE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
81 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
82
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
83 if (!(the_MonitorFromPoint = (purple_MonitorFromPoint*)
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
84 GetProcAddress(hmod, "MonitorFromPoint"))) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
85 return FALSE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
86 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
87
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
88 monitor =
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
89 the_MonitorFromPoint(pt, MONITOR_DEFAULTTOPRIMARY);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
90
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
91 return get_rect_from_monitor(hmod, monitor, rect);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
92 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
93
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
94 /**
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
95 * This will only work on Win98+ and Win2K+
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
96 * Return TRUE if successful, otherwise FALSE
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
97 */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
98 static gboolean
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
99 get_rect_of_window_multimonitor(HWND window, RECT *rect) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
100 HMODULE hmod;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
101 purple_MonitorFromWindow *the_MonitorFromWindow;
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
102 HMONITOR monitor;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
103
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
104 if (!(hmod = GetModuleHandle("user32"))) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
105 return FALSE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
106 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
107
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
108 if (!(the_MonitorFromWindow = (purple_MonitorFromWindow*)
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
109 GetProcAddress(hmod, "MonitorFromWindow"))) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
110 return FALSE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
111 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
112
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
113 monitor =
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
114 the_MonitorFromWindow(window, MONITOR_DEFAULTTOPRIMARY);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
115
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
116 return get_rect_from_monitor(hmod, monitor, rect);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
117 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
118
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
119 /*
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
120 * Fallback if cannot get the RECT from the monitor directly
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
121 */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
122 static void get_default_workarea(RECT *rect) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
123 if (!SystemParametersInfo(SPI_GETWORKAREA, 0, &rect, FALSE)) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
124 /* I don't think this will ever happen */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
125 rect->left = 0;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
126 rect->top = 0;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
127 rect->bottom = GetSystemMetrics(SM_CYSCREEN);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
128 rect->right = GetSystemMetrics(SM_CXSCREEN);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
129 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
130 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
131
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
132 /* Retrieve the rectangle of the active work area at a point */
15697
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
133 static void get_rect_at_point(POINT pt, RECT *rc) {
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
134 if (!get_rect_at_point_multimonitor(pt, rc)) {
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
135 get_default_workarea(rc);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
136 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
137 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
138
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
139 /* Retrieve the rectangle of the active work area of a window*/
15697
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
140 static void get_rect_of_window(HWND window, RECT *rc) {
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
141 if (!get_rect_of_window_multimonitor(window, rc)) {
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
142 get_default_workarea(rc);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
143 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
144 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
145
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
146 static void get_window_normal_rc(HWND hwnd, RECT *rc) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
147 WINDOWPLACEMENT wplc;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
148 GetWindowPlacement(hwnd, &wplc);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
149 CopyRect(rc, &wplc.rcNormalPosition);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
150 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
151 #if 0
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
152 static void print_rect(RECT *rc) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
153 purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "RECT: L:%ld R:%ld T:%ld B:%ld\n",
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
154 rc->left, rc->right, rc->top, rc->bottom);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
155 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
156 #endif
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
157 /** Set the window style to be the "Tool Window" style - small header, no min/max buttons */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
158 static void set_toolbar(HWND hwnd, gboolean val) {
19395
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
159 LONG style = GetWindowLong(hwnd, GWL_EXSTYLE);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
160
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
161 if(val && !(style & WS_EX_TOOLWINDOW))
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
162 style |= WS_EX_TOOLWINDOW;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
163 else if(!val && style & WS_EX_TOOLWINDOW)
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
164 style &= ~WS_EX_TOOLWINDOW;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
165 else
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
166 return;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
167 SetWindowLong(hwnd, GWL_EXSTYLE, style);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
168 SetWindowPos(hwnd, 0, 0, 0, 0, 0,
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
169 SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 25910
diff changeset
170
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
171 /* This really should be the following, but SWP_FRAMECHANGED strangely causes initermittent problems "Show Desktop" done more than once.
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
172 * Not having SWP_FRAMECHANGED *should* cause the Style not to be applied, but i haven't noticed any problems
15697
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
173 * SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
174 */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
175 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
176 /** Register the window as an appbar */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
177 static gboolean gtk_appbar_register(GtkAppBar *ab, HWND hwnd) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
178 APPBARDATA abd;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
179
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
180 abd.cbSize = sizeof(APPBARDATA);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
181 abd.hWnd = hwnd;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
182 abd.uCallbackMessage = APPBAR_CALLBACK;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
183
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
184 ab->registered = SHAppBarMessage(ABM_NEW, &abd);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
185
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
186 return ab->registered;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
187 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
188 /** Unregister the window as an appbar */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
189 static gboolean gtk_appbar_unregister(GtkAppBar *ab, HWND hwnd) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
190 APPBARDATA abd;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
191
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
192 if(!ab->registered)
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
193 return TRUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
194
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
195 abd.cbSize = sizeof(APPBARDATA);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
196 abd.hWnd = hwnd;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
197
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
198 SHAppBarMessage(ABM_REMOVE, &abd); /** This always returns TRUE */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
199
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
200 ab->registered = FALSE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
201
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
202 ab->docked = FALSE;
19395
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
203 ab->undocking = FALSE;
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
204 ab->docking = FALSE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
205
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
206 return TRUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
207 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
208
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
209 static void gtk_appbar_querypos(GtkAppBar *ab, HWND hwnd, RECT rcWorkspace) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
210 APPBARDATA abd;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
211 guint iWidth = 0;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
212
15697
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
213 if(!ab->registered)
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
214 gtk_appbar_register(ab, hwnd);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
215
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
216 abd.hWnd = hwnd;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
217 abd.cbSize = sizeof(APPBARDATA);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
218 abd.uEdge = ab->side;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
219
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
220 iWidth = ab->docked_rect.right - ab->docked_rect.left;
15697
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
221
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
222 abd.rc.top = rcWorkspace.top;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
223 abd.rc.bottom = rcWorkspace.bottom;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
224 switch (abd.uEdge)
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
225 {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
226 case ABE_LEFT:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
227 abd.rc.left = rcWorkspace.left;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
228 abd.rc.right = rcWorkspace.left + iWidth;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
229 break;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
230
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
231 case ABE_RIGHT:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
232 abd.rc.right = rcWorkspace.right;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
233 abd.rc.left = rcWorkspace.right - iWidth;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
234 break;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
235 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
236
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
237 /* Ask the system for the screen space */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
238 SHAppBarMessage(ABM_QUERYPOS, &abd);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
239
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
240 switch (abd.uEdge)
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
241 {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
242 case ABE_LEFT:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
243 abd.rc.right = abd.rc.left + iWidth;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
244 break;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
245
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
246 case ABE_RIGHT:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
247 abd.rc.left = abd.rc.right - iWidth;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
248 break;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
249 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
250
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
251 CopyRect(&(ab->docked_rect), &abd.rc);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
252 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
253 /* Actually set the size and screen location of the appbar */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
254 static void gtk_appbar_setpos(GtkAppBar *ab, HWND hwnd) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
255 APPBARDATA abd;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
256
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
257 if(!ab->registered)
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
258 gtk_appbar_register(ab, hwnd);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
259
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
260 abd.hWnd = hwnd;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
261 abd.cbSize = sizeof(APPBARDATA);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
262 CopyRect(&abd.rc, &(ab->docked_rect));
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
263 abd.uEdge = ab->side;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
264
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
265 SHAppBarMessage(ABM_SETPOS, &abd);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
266 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
267 /** Let any callbacks know that we have docked or undocked */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
268 static void gtk_appbar_dispatch_dock_cbs(GtkAppBar *ab, gboolean val) {
19395
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
269 GSList *lst = ab->dock_cbs;
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
270
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
271 while(lst) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
272 GtkAppBarDockCB dock_cb = lst->data;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
273 dock_cb(val);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
274 lst = lst->next;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
275 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
276 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
277
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
278 static GdkFilterReturn wnd_moving(GtkAppBar *ab, GdkXEvent *xevent) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
279 MSG *msg = (MSG*)xevent;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
280 POINT cp;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
281 RECT *rc = (RECT*)msg->lParam;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
282 RECT monRect;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
283 int side = -1;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
284 long dockAreaWidth = 0;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
285
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
286 purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "wnd_moving\n");
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
287
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
288 GetCursorPos(&cp);
15697
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
289 get_rect_at_point(cp, &monRect);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
290
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
291 dockAreaWidth = (monRect.right - monRect.left) / 10;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
292 /* Which part of the screen are we in ? */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
293 if (cp.x > (monRect.right - dockAreaWidth)) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
294 side = ABE_RIGHT;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
295 } else if (cp.x < (monRect.left + dockAreaWidth)) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
296 side = ABE_LEFT;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
297 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
298
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
299 if(!ab->docked) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
300 if( (side == ABE_RIGHT || side == ABE_LEFT) ) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
301 if( !ab->docking ) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
302 ab->side = side;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
303 GetWindowRect(msg->hwnd, &(ab->docked_rect));
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
304 gtk_appbar_querypos(ab, msg->hwnd, monRect);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
305
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
306 /* save pre-docking height */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
307 ab->undocked_height = rc->bottom - rc->top;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
308 ab->docking = TRUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
309 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
310 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
311 else
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
312 ab->docking = FALSE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
313 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
314 else if(side < 0) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
315 gtk_appbar_unregister(ab, msg->hwnd);
19395
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
316 ab->undocking = TRUE;
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
317 rc->bottom = rc->top + ab->undocked_height;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
318 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
319
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
320 return GDK_FILTER_CONTINUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
321 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
322
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
323 static GdkFilterReturn wnd_sizing(GtkAppBar *ab, GdkXEvent *xevent) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
324 MSG *msg = (MSG*)xevent;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
325
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
326 purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "wnd_sizing\n");
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
327 if(ab->docked) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
328 RECT *rc = (RECT*)msg->lParam;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
329 if(ab->side == ABE_LEFT && msg->wParam == WMSZ_RIGHT) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
330 ab->docked_rect.right = rc->right;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
331 gtk_appbar_setpos(ab, msg->hwnd);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
332 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
333 else if(ab->side == ABE_RIGHT && msg->wParam == WMSZ_LEFT) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
334 ab->docked_rect.left = rc->left;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
335 gtk_appbar_setpos(ab, msg->hwnd);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
336 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
337 return GDK_FILTER_REMOVE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
338 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
339 return GDK_FILTER_CONTINUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
340 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
341 /** Notify the system that the appbar has been activated */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
342 static GdkFilterReturn wnd_activate(GtkAppBar *ab, GdkXEvent *xevent) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
343 if (ab->registered) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
344 APPBARDATA abd;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
345 MSG *msg = (MSG*)xevent;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
346 purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "wnd_activate\n");
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
347
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
348 abd.hWnd = msg->hwnd;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
349 abd.cbSize = sizeof(APPBARDATA);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
350
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
351 SHAppBarMessage(ABM_ACTIVATE, &abd);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
352 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
353 return GDK_FILTER_CONTINUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
354 }
20846
370ee55e1acb 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.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
355
370ee55e1acb 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.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
356 static void show_hide(GtkAppBar *ab, gboolean hide) {
370ee55e1acb 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.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
357 purple_debug_info("gtkappbar", "show_hide(%d)\n", hide);
370ee55e1acb 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.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
358
370ee55e1acb 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.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
359 if (hide) {
370ee55e1acb 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.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
360 purple_debug_info("gtkappbar", "hidden\n");
370ee55e1acb 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.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
361 gtk_appbar_unregister(ab, GDK_WINDOW_HWND(ab->win->window));
370ee55e1acb 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.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
362 ab->docked = TRUE;
370ee55e1acb 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.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
363 ab->iconized = TRUE;
370ee55e1acb 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.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
364 } else {
370ee55e1acb 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.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
365 ab->iconized = FALSE;
370ee55e1acb 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.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
366 purple_debug_info("gtkappbar", "shown\n");
370ee55e1acb 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.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
367 ab->docked = FALSE;
370ee55e1acb 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.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
368 gtk_appbar_do_dock(ab, ab->side);
370ee55e1acb 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.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
369 }
370ee55e1acb 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.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
370
370ee55e1acb 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.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
371 }
370ee55e1acb 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.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
372
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
373 /** Notify the system that the appbar's position has changed */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
374 static GdkFilterReturn wnd_poschanged(GtkAppBar *ab, GdkXEvent *xevent) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
375 if (ab->registered) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
376 APPBARDATA abd;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
377 MSG *msg = (MSG*)xevent;
20846
370ee55e1acb 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.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
378
25910
d24c4a9d28f2 Changing debug levels. These messages fire every single time a window changes focus, making debugging anything else impossible
Casey Ho <caseyho@pidgin.im>
parents: 20846
diff changeset
379 purple_debug(PURPLE_DEBUG_MISC, "gtkappbar", "wnd_poschanged\n");
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
380
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
381 abd.hWnd = msg->hwnd;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
382 abd.cbSize = sizeof(APPBARDATA);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
383
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
384 SHAppBarMessage(ABM_WINDOWPOSCHANGED, &abd);
20846
370ee55e1acb 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.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
385
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
386 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
387 return GDK_FILTER_CONTINUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
388 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
389 /** The window is about to change */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
390 static GdkFilterReturn wnd_poschanging(GtkAppBar *ab, GdkXEvent *xevent) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
391 MSG *msg = (MSG*)xevent;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
392 WINDOWPOS *wpos = (WINDOWPOS*)msg->lParam;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
393
25910
d24c4a9d28f2 Changing debug levels. These messages fire every single time a window changes focus, making debugging anything else impossible
Casey Ho <caseyho@pidgin.im>
parents: 20846
diff changeset
394 purple_debug(PURPLE_DEBUG_MISC, "gtkappbar", "wnd_poschanging\n");
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
395
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
396 if(ab->docked || ab->docking) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
397 wpos->x = ab->docked_rect.left;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
398 wpos->y = ab->docked_rect.top;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
399 wpos->cx = ab->docked_rect.right - ab->docked_rect.left;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
400 wpos->cy = ab->docked_rect.bottom - ab->docked_rect.top;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
401 if(IsIconic(msg->hwnd))
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
402 set_toolbar(msg->hwnd, FALSE);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
403 /*return GDK_FILTER_REMOVE;*/
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
404 }
20846
370ee55e1acb 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.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
405
370ee55e1acb 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.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
406 if (ab->docked) {
370ee55e1acb 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.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
407 if (ab->iconized && wpos->flags & SWP_SHOWWINDOW)
370ee55e1acb 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.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
408 show_hide(ab, FALSE);
370ee55e1acb 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.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
409 else if (!ab->iconized && wpos->flags & SWP_HIDEWINDOW)
370ee55e1acb 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.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
410 show_hide(ab, TRUE);
370ee55e1acb 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.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
411 }
370ee55e1acb 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.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
412
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
413 return GDK_FILTER_CONTINUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
414 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
415
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
416 static GdkFilterReturn wnd_exitsizemove(GtkAppBar *ab, GdkXEvent *xevent) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
417 MSG *msg = (MSG*)xevent;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
418
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
419 purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "wnd_exitsizemove\n");
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
420 if(ab->docking) {
19395
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
421 gtk_appbar_setpos(ab, msg->hwnd);
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
422 ab->docking = FALSE;
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
423 ab->docked = TRUE;
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
424 ShowWindow(msg->hwnd, SW_HIDE);
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
425 set_toolbar(msg->hwnd, TRUE);
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
426 ShowWindow(msg->hwnd, SW_SHOW);
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
427 gtk_appbar_dispatch_dock_cbs(ab, TRUE);
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
428 } else if(ab->undocking) {
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
429 ShowWindow(msg->hwnd, SW_HIDE);
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
430 set_toolbar(msg->hwnd, FALSE);
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
431 ShowWindow(msg->hwnd, SW_SHOW);
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
432 gtk_appbar_dispatch_dock_cbs(ab, FALSE);
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
433 ab->undocking = FALSE;
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
434 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
435
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
436 return GDK_FILTER_CONTINUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
437 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
438
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
439 static GdkFilterReturn wnd_showwindow(GtkAppBar *ab, GdkXEvent *xevent) {
20846
370ee55e1acb 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.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
440 MSG *msg = (MSG*)xevent;
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
441
20846
370ee55e1acb 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.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
442 purple_debug_info("gtkappbar", "wnd_showwindow\n");
370ee55e1acb 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.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
443 if(msg->wParam && ab->docked) {
370ee55e1acb 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.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
444 show_hide(ab, FALSE);
370ee55e1acb 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.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
445 } else if(!msg->wParam && ab->docked) {
370ee55e1acb 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.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
446 show_hide(ab, TRUE);
370ee55e1acb 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.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
447 }
370ee55e1acb 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.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
448 return GDK_FILTER_CONTINUE;
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
449 }
20846
370ee55e1acb 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.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
450
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
451 /** The window's size has changed */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
452 static GdkFilterReturn wnd_size(GtkAppBar *ab, GdkXEvent *xevent) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
453 MSG *msg = (MSG*)xevent;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
454
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
455 purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "wnd_size\n");
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
456
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
457 if(msg->wParam == SIZE_MINIMIZED) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
458 purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "Minimize\n");
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
459 if(ab->docked) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
460 gtk_appbar_unregister(ab, GDK_WINDOW_HWND(ab->win->window));
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
461 ab->docked = TRUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
462 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
463 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
464 else if(msg->wParam == SIZE_RESTORED) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
465 purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "Restore\n");
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
466 if (!ab->iconized && ab->docked) {
19395
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
467 gtk_appbar_do_dock(ab, ab->side);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
468 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
469 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
470 return GDK_FILTER_CONTINUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
471 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
472
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
473 static GdkFilterReturn wnd_nchittest(GtkAppBar *ab, GdkXEvent *xevent) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
474 MSG *msg = (MSG*)xevent;
15697
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
475
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
476 if(ab->docked) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
477 UINT ret = DefWindowProc(msg->hwnd, msg->message, msg->wParam, msg->lParam);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
478
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
479 switch(ret) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
480 case HTBOTTOM:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
481 case HTBOTTOMLEFT:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
482 case HTBOTTOMRIGHT:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
483 case HTTOP:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
484 case HTTOPLEFT:
15697
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
485 case HTTOPRIGHT:
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
486 return GDK_FILTER_REMOVE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
487 case HTLEFT:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
488 if(ab->side == ABE_LEFT)
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
489 return GDK_FILTER_REMOVE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
490 break;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
491 case HTRIGHT:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
492 if(ab->side == ABE_RIGHT)
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
493 return GDK_FILTER_REMOVE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
494 break;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
495 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
496 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
497 return GDK_FILTER_CONTINUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
498 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
499
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
500 #if 0
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
501 static GdkFilterReturn wnd_initmenupopup(GtkAppBar *ab, GdkXEvent *xevent) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
502 MSG *msg = (MSG*)xevent;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
503
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
504 if(ab->docked && HIWORD(msg->lParam)) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
505 HMENU sysmenu = GetSystemMenu(msg->hwnd, FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
506 purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "wnd_initpopupmenu: docked: %d ismenu: %d\n", ab->docked, IsMenu(sysmenu));
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
507 if(EnableMenuItem(sysmenu, SC_MAXIMIZE, MF_BYCOMMAND|MF_GRAYED)<0)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
508 purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "SC_MAXIMIZE Menu item does not exist\n");
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
509 if(EnableMenuItem(sysmenu, SC_MOVE, MF_BYCOMMAND|MF_GRAYED)<0)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
510 purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "SC_MOVE Menu item does not exist\n");
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
511 return GDK_FILTER_CONTINUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
512 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
513 else
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
514 GetSystemMenu(msg->hwnd, TRUE);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
515 return GDK_FILTER_CONTINUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
516 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
517 #endif
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
518
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
519 static GdkFilterReturn gtk_appbar_callback(GtkAppBar *ab, GdkXEvent *xevent) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
520 MSG *msg = (MSG*)xevent;
15697
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
521 RECT orig, windowRect;
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
522
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
523 switch (msg->wParam) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
524 case ABN_STATECHANGE:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
525 purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "gtk_appbar_callback: ABN_STATECHANGE\n");
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
526 break;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
527
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
528 case ABN_FULLSCREENAPP:
25910
d24c4a9d28f2 Changing debug levels. These messages fire every single time a window changes focus, making debugging anything else impossible
Casey Ho <caseyho@pidgin.im>
parents: 20846
diff changeset
529 purple_debug(PURPLE_DEBUG_MISC, "gtkappbar", "gtk_appbar_callback: ABN_FULLSCREENAPP: %d\n", (BOOL)msg->lParam);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
530 if (!ab->iconized && ab->docked) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
531 if ((BOOL)msg->lParam) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
532 SetWindowPos(msg->hwnd, HWND_BOTTOM, 0, 0, 0, 0,
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
533 SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
534 } else {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
535 SetWindowPos(msg->hwnd, HWND_NOTOPMOST, 0, 0, 0, 0,
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
536 SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_FRAMECHANGED);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
537 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
538 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
539
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
540 break;
15697
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
541 case ABN_POSCHANGED:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
542 purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "gtk_appbar_callback: ABN_POSCHANGED\n");
15697
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
543 CopyRect(&orig, &(ab->docked_rect));
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
544 get_rect_of_window(msg->hwnd, &windowRect);
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
545 gtk_appbar_querypos(ab, msg->hwnd, windowRect);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
546 if (EqualRect(&orig, &(ab->docked_rect)) == 0) {
15697
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
547 MoveWindow(msg->hwnd, ab->docked_rect.left, ab->docked_rect.top,
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
548 ab->docked_rect.right - ab->docked_rect.left,
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
549 ab->docked_rect.bottom - ab->docked_rect.top, TRUE);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
550 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
551 gtk_appbar_setpos(ab, msg->hwnd);
15697
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
552 break;
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
553 #if 0
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
554 default:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
555 purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "gtk_appbar_callback: %d\n", msg->wParam);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
556 #endif
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
557 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
558 return GDK_FILTER_CONTINUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
559 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
560
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
561 static GdkFilterReturn gtk_appbar_event_filter(GdkXEvent *xevent, GdkEvent *event, gpointer data) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
562 MSG *msg = (MSG*)xevent;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
563
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
564 /*printf("MSG: %s\n", message_to_string (msg->message));*/
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
565 switch(msg->message) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
566 case WM_EXITSIZEMOVE:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
567 return wnd_exitsizemove(data, xevent);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
568 case WM_WINDOWPOSCHANGING:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
569 return wnd_poschanging(data, xevent);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
570 case WM_WINDOWPOSCHANGED:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
571 return wnd_poschanged(data, xevent);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
572 case WM_ACTIVATE:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
573 return wnd_activate(data, xevent);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
574 case WM_SIZING:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
575 return wnd_sizing(data, xevent);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
576 case WM_MOVING:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
577 return wnd_moving(data, xevent);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
578 case WM_SHOWWINDOW:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
579 return wnd_showwindow(data, xevent);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
580 case WM_NCHITTEST:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
581 return wnd_nchittest(data, xevent);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
582 #if 0
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
583 case WM_INITMENUPOPUP:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
584 return wnd_initmenupopup(data, xevent);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
585 #endif
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
586 case WM_SIZE:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
587 return wnd_size(data, xevent);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
588 case APPBAR_CALLBACK:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
589 return gtk_appbar_callback(data, xevent);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
590 #if 0
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
591 default:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
592 purple_debug_info("gtkappbar", "gtk_appbar_event_filter %d\n", msg->message);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
593 #endif
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
594 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
595 return GDK_FILTER_CONTINUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
596 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
597
19395
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
598 static void gtk_appbar_do_dock(GtkAppBar *ab, UINT side) {
15697
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
599 RECT orig, windowRect;
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
600
19395
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
601 purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "gtk_appbar_do_dock\n");
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
602
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
603 if(!ab || !IsWindow(GDK_WINDOW_HWND(ab->win->window)))
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
604 return;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
605
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
606 ab->side = side;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
607 get_window_normal_rc(GDK_WINDOW_HWND(ab->win->window), &(ab->docked_rect));
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
608 CopyRect(&orig, &(ab->docked_rect));
15697
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
609 get_rect_of_window(GDK_WINDOW_HWND(ab->win->window), &windowRect);
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
610 gtk_appbar_querypos(ab, GDK_WINDOW_HWND(ab->win->window), windowRect);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
611 if(EqualRect(&orig, &(ab->docked_rect)) == 0)
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
612 MoveWindow(GDK_WINDOW_HWND(ab->win->window),
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
613 ab->docked_rect.left,
15697
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
614 ab->docked_rect.top,
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
615 ab->docked_rect.right - ab->docked_rect.left,
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
616 ab->docked_rect.bottom - ab->docked_rect.top, TRUE);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
617 gtk_appbar_setpos(ab, GDK_WINDOW_HWND(ab->win->window));
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
618 ab->docked = TRUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
619 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
620
19395
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
621 void gtk_appbar_dock(GtkAppBar *ab, UINT side) {
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
622 HWND hwnd;
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
623
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
624 g_return_if_fail(ab != NULL);
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
625
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
626 hwnd = GDK_WINDOW_HWND(ab->win->window);
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
627
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
628 g_return_if_fail(IsWindow(hwnd));
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
629
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
630 ab->iconized = IsIconic(hwnd);
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
631
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
632 if (!ab->docked && !ab->iconized)
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
633 ShowWindow(hwnd, SW_HIDE);
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
634 gtk_appbar_do_dock(ab, side);
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
635 set_toolbar(hwnd, TRUE);
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
636 if (!ab->iconized)
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
637 ShowWindow(hwnd, SW_SHOW);
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
638 }
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
639
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
640 void gtk_appbar_add_dock_cb(GtkAppBar *ab, GtkAppBarDockCB dock_cb) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
641 if(!ab)
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
642 return;
19395
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
643 ab->dock_cbs = g_slist_prepend(ab->dock_cbs, dock_cb);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
644 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
645
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
646 GtkAppBar *gtk_appbar_add(GtkWidget *win) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
647 GtkAppBar *ab;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
648
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
649 purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "gtk_appbar_add\n");
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
650
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
651 if(!win)
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
652 return NULL;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
653 ab = g_new0(GtkAppBar, 1);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
654 ab->win = win;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
655
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
656 /* init docking coords */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
657 get_window_normal_rc(GDK_WINDOW_HWND(win->window), &(ab->docked_rect));
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
658
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
659 /* Add main window filter */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
660 gdk_window_add_filter(win->window,
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
661 gtk_appbar_event_filter,
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
662 ab);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
663 return ab;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
664 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
665
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
666 void gtk_appbar_remove(GtkAppBar *ab) {
19395
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
667 HWND hwnd;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
668 purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "gtk_appbar_remove\n");
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
669
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
670 if(!ab)
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
671 return;
19395
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
672
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
673 hwnd = GDK_WINDOW_HWND(ab->win->window);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
674 gdk_window_remove_filter(ab->win->window,
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
675 gtk_appbar_event_filter,
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
676 ab);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
677 if(ab->docked) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
678 gtk_window_resize(GTK_WINDOW(ab->win),
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
679 ab->docked_rect.right - ab->docked_rect.left,
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
680 ab->undocked_height);
19395
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
681 if (!ab->iconized)
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
682 ShowWindow(hwnd, SW_HIDE);
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
683 set_toolbar(hwnd, FALSE);
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
684 if (!ab->iconized)
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
685 ShowWindow(hwnd, SW_SHOW);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
686 }
19395
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
687 gtk_appbar_unregister(ab, hwnd);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
688
19395
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
689 while (ab->dock_cbs)
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
690 ab->dock_cbs = g_slist_remove(ab->dock_cbs, ab->dock_cbs->data);
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
691
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
692 g_free(ab);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
693 }

mercurial