pidgin/plugins/win32/winprefs/gtkappbar.c

Sat, 08 Sep 2007 03:09:35 +0000

author
John Bailey <rekkanoryo@rekkanoryo.org>
date
Sat, 08 Sep 2007 03:09:35 +0000
changeset 19859
71d37b57eff2
parent 19395
13e591244b33
child 20846
370ee55e1acb
permissions
-rw-r--r--

The FSF changed its address a while ago; our files were out of date.
This is a quick update done with a for loop, find, and sed.

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);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
170
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 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
355 /** Notify the system that the appbar's position has changed */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
356 static GdkFilterReturn wnd_poschanged(GtkAppBar *ab, GdkXEvent *xevent) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
357 if (ab->registered) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
358 APPBARDATA abd;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
359 MSG *msg = (MSG*)xevent;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
360 purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "wnd_poschanged\n");
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
361
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
362 abd.hWnd = msg->hwnd;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
363 abd.cbSize = sizeof(APPBARDATA);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
364
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
365 SHAppBarMessage(ABM_WINDOWPOSCHANGED, &abd);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
366 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
367 return GDK_FILTER_CONTINUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
368 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
369 /** The window is about to change */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
370 static GdkFilterReturn wnd_poschanging(GtkAppBar *ab, GdkXEvent *xevent) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
371 MSG *msg = (MSG*)xevent;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
372 WINDOWPOS *wpos = (WINDOWPOS*)msg->lParam;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
373
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
374 purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "wnd_poschanging\n");
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
375
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
376 if(ab->docked || ab->docking) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
377 wpos->x = ab->docked_rect.left;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
378 wpos->y = ab->docked_rect.top;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
379 wpos->cx = ab->docked_rect.right - ab->docked_rect.left;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
380 wpos->cy = ab->docked_rect.bottom - ab->docked_rect.top;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
381 if(IsIconic(msg->hwnd))
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
382 set_toolbar(msg->hwnd, FALSE);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
383 /*return GDK_FILTER_REMOVE;*/
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
384 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
385 return GDK_FILTER_CONTINUE;
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
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
388 static GdkFilterReturn wnd_exitsizemove(GtkAppBar *ab, GdkXEvent *xevent) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
389 MSG *msg = (MSG*)xevent;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
390
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
391 purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "wnd_exitsizemove\n");
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
392 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
393 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
394 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
395 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
396 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
397 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
398 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
399 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
400 } 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
401 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
402 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
403 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
404 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
405 ab->undocking = FALSE;
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
406 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
407
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
408 return GDK_FILTER_CONTINUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
409 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
410
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
411 static GdkFilterReturn wnd_showwindow(GtkAppBar *ab, GdkXEvent *xevent) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
412 MSG *msg = (MSG*)xevent;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
413
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
414 purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "wnd_showwindow\n");
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
415 if(msg->wParam && ab->docked) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
416 ab->iconized = FALSE;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
417 purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "shown\n");
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
418 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
419 gtk_appbar_do_dock(ab, ab->side);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
420 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
421 else if(!msg->wParam && ab->docked) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
422 purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "hidden\n");
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
423 gtk_appbar_unregister(ab, GDK_WINDOW_HWND(ab->win->window));
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
424 ab->docked = TRUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
425 ab->iconized = TRUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
426 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
427 return GDK_FILTER_CONTINUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
428 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
429 /** The window's size has changed */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
430 static GdkFilterReturn wnd_size(GtkAppBar *ab, GdkXEvent *xevent) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
431 MSG *msg = (MSG*)xevent;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
432
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
433 purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "wnd_size\n");
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 if(msg->wParam == SIZE_MINIMIZED) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
436 purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "Minimize\n");
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
437 if(ab->docked) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
438 gtk_appbar_unregister(ab, GDK_WINDOW_HWND(ab->win->window));
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
439 ab->docked = TRUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
440 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
441 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
442 else if(msg->wParam == SIZE_RESTORED) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
443 purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "Restore\n");
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
444 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
445 gtk_appbar_do_dock(ab, ab->side);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
446 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
447 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
448 return GDK_FILTER_CONTINUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
449 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
450
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
451 static GdkFilterReturn wnd_nchittest(GtkAppBar *ab, GdkXEvent *xevent) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
452 MSG *msg = (MSG*)xevent;
15697
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
453
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
454 if(ab->docked) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
455 UINT ret = DefWindowProc(msg->hwnd, msg->message, msg->wParam, msg->lParam);
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 switch(ret) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
458 case HTBOTTOM:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
459 case HTBOTTOMLEFT:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
460 case HTBOTTOMRIGHT:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
461 case HTTOP:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
462 case HTTOPLEFT:
15697
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
463 case HTTOPRIGHT:
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
464 return GDK_FILTER_REMOVE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
465 case HTLEFT:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
466 if(ab->side == ABE_LEFT)
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
467 return GDK_FILTER_REMOVE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
468 break;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
469 case HTRIGHT:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
470 if(ab->side == ABE_RIGHT)
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
471 return GDK_FILTER_REMOVE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
472 break;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
473 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
474 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
475 return GDK_FILTER_CONTINUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
476 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
477
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
478 #if 0
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
479 static GdkFilterReturn wnd_initmenupopup(GtkAppBar *ab, GdkXEvent *xevent) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
480 MSG *msg = (MSG*)xevent;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
481
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
482 if(ab->docked && HIWORD(msg->lParam)) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
483 HMENU sysmenu = GetSystemMenu(msg->hwnd, FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
484 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
485 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
486 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
487 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
488 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
489 return GDK_FILTER_CONTINUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
490 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
491 else
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
492 GetSystemMenu(msg->hwnd, TRUE);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
493 return GDK_FILTER_CONTINUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
494 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
495 #endif
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 static GdkFilterReturn gtk_appbar_callback(GtkAppBar *ab, GdkXEvent *xevent) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
498 MSG *msg = (MSG*)xevent;
15697
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
499 RECT orig, windowRect;
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
500
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
501 switch (msg->wParam) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
502 case ABN_STATECHANGE:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
503 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
504 break;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
505
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
506 case ABN_FULLSCREENAPP:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
507 purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "gtk_appbar_callback: ABN_FULLSCREENAPP: %d\n", (BOOL)msg->lParam);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
508 if (!ab->iconized && ab->docked) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
509 if ((BOOL)msg->lParam) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
510 SetWindowPos(msg->hwnd, HWND_BOTTOM, 0, 0, 0, 0,
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
511 SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
512 } else {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
513 SetWindowPos(msg->hwnd, HWND_NOTOPMOST, 0, 0, 0, 0,
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
514 SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_FRAMECHANGED);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
515 }
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
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
518 break;
15697
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
519 case ABN_POSCHANGED:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
520 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
521 CopyRect(&orig, &(ab->docked_rect));
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
522 get_rect_of_window(msg->hwnd, &windowRect);
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
523 gtk_appbar_querypos(ab, msg->hwnd, windowRect);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
524 if (EqualRect(&orig, &(ab->docked_rect)) == 0) {
15697
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
525 MoveWindow(msg->hwnd, ab->docked_rect.left, ab->docked_rect.top,
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
526 ab->docked_rect.right - ab->docked_rect.left,
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
527 ab->docked_rect.bottom - ab->docked_rect.top, TRUE);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
528 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
529 gtk_appbar_setpos(ab, msg->hwnd);
15697
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
530 break;
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
531 #if 0
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
532 default:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
533 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
534 #endif
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
535 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
536 return GDK_FILTER_CONTINUE;
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 static GdkFilterReturn gtk_appbar_event_filter(GdkXEvent *xevent, GdkEvent *event, gpointer data) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
540 MSG *msg = (MSG*)xevent;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
541
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
542 /*printf("MSG: %s\n", message_to_string (msg->message));*/
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
543 switch(msg->message) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
544 case WM_EXITSIZEMOVE:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
545 return wnd_exitsizemove(data, xevent);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
546 case WM_WINDOWPOSCHANGING:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
547 return wnd_poschanging(data, xevent);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
548 case WM_WINDOWPOSCHANGED:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
549 return wnd_poschanged(data, xevent);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
550 case WM_ACTIVATE:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
551 return wnd_activate(data, xevent);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
552 case WM_SIZING:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
553 return wnd_sizing(data, xevent);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
554 case WM_MOVING:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
555 return wnd_moving(data, xevent);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
556 case WM_SHOWWINDOW:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
557 return wnd_showwindow(data, xevent);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
558 case WM_NCHITTEST:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
559 return wnd_nchittest(data, xevent);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
560 #if 0
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
561 case WM_INITMENUPOPUP:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
562 return wnd_initmenupopup(data, xevent);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
563 #endif
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
564 case WM_SIZE:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
565 return wnd_size(data, xevent);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
566 case APPBAR_CALLBACK:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
567 return gtk_appbar_callback(data, xevent);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
568 #if 0
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
569 default:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
570 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
571 #endif
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
572 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
573 return GDK_FILTER_CONTINUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
574 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
575
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
576 static void gtk_appbar_do_dock(GtkAppBar *ab, UINT side) {
15697
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
577 RECT orig, windowRect;
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
578
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
579 purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "gtk_appbar_do_dock\n");
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
580
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
581 if(!ab || !IsWindow(GDK_WINDOW_HWND(ab->win->window)))
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
582 return;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
583
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
584 ab->side = side;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
585 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
586 CopyRect(&orig, &(ab->docked_rect));
15697
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
587 get_rect_of_window(GDK_WINDOW_HWND(ab->win->window), &windowRect);
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
588 gtk_appbar_querypos(ab, GDK_WINDOW_HWND(ab->win->window), windowRect);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
589 if(EqualRect(&orig, &(ab->docked_rect)) == 0)
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
590 MoveWindow(GDK_WINDOW_HWND(ab->win->window),
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
591 ab->docked_rect.left,
15697
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
592 ab->docked_rect.top,
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
593 ab->docked_rect.right - ab->docked_rect.left,
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
594 ab->docked_rect.bottom - ab->docked_rect.top, TRUE);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
595 gtk_appbar_setpos(ab, GDK_WINDOW_HWND(ab->win->window));
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
596 ab->docked = TRUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
597 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
598
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
599 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
600 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
601
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
602 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
603
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
604 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
605
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
606 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
607
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
608 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
609
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
610 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
611 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
612 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
613 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
614 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
615 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
616 }
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
617
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
618 void gtk_appbar_add_dock_cb(GtkAppBar *ab, GtkAppBarDockCB dock_cb) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
619 if(!ab)
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
620 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
621 ab->dock_cbs = g_slist_prepend(ab->dock_cbs, dock_cb);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
622 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
623
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
624 GtkAppBar *gtk_appbar_add(GtkWidget *win) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
625 GtkAppBar *ab;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
626
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
627 purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "gtk_appbar_add\n");
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
628
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
629 if(!win)
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
630 return NULL;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
631 ab = g_new0(GtkAppBar, 1);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
632 ab->win = win;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
633
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
634 /* init docking coords */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
635 get_window_normal_rc(GDK_WINDOW_HWND(win->window), &(ab->docked_rect));
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
636
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
637 /* Add main window filter */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
638 gdk_window_add_filter(win->window,
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
639 gtk_appbar_event_filter,
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
640 ab);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
641 return ab;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
642 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
643
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
644 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
645 HWND hwnd;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
646 purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "gtk_appbar_remove\n");
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
647
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
648 if(!ab)
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
649 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
650
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
651 hwnd = GDK_WINDOW_HWND(ab->win->window);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
652 gdk_window_remove_filter(ab->win->window,
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
653 gtk_appbar_event_filter,
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
654 ab);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
655 if(ab->docked) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
656 gtk_window_resize(GTK_WINDOW(ab->win),
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
657 ab->docked_rect.right - ab->docked_rect.left,
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
658 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
659 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
660 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
661 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
662 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
663 ShowWindow(hwnd, SW_SHOW);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
664 }
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
665 gtk_appbar_unregister(ab, hwnd);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
666
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 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
668 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
669
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
670 g_free(ab);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
671 }

mercurial