pidgin/plugins/win32/winprefs/gtkappbar.c

Thu, 26 Mar 2020 20:23:10 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Thu, 26 Mar 2020 20:23:10 -0500
changeset 40314
379340e9c772
parent 40079
a37a1e349491
child 40360
e21f3bbcc2a5
permissions
-rw-r--r--

Add a null check to the ui_info unref in jabber

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
35896
bfee243ed8b1 cross-win32: fix gtk3 build
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 31294
diff changeset
46 static inline HWND
bfee243ed8b1 cross-win32: fix gtk3 build
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 31294
diff changeset
47 appbar_get_handle(GtkAppBar *ab)
bfee243ed8b1 cross-win32: fix gtk3 build
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 31294
diff changeset
48 {
bfee243ed8b1 cross-win32: fix gtk3 build
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 31294
diff changeset
49 return GDK_WINDOW_HWND(gtk_widget_get_window(ab->win));
bfee243ed8b1 cross-win32: fix gtk3 build
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 31294
diff changeset
50 }
bfee243ed8b1 cross-win32: fix gtk3 build
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 31294
diff changeset
51
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
52 /* Retrieve the rectangular display area from the specified monitor
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
53 * Return TRUE if successful, otherwise FALSE
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
54 */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
55 static gboolean
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
56 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
57 purple_GetMonitorInfo *the_GetMonitorInfo;
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
58 MONITORINFO info;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
59
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
60 if (!(the_GetMonitorInfo = (purple_GetMonitorInfo*)
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
61 GetProcAddress(hmod, "GetMonitorInfoA"))) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
62 return FALSE;
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
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
65 info.cbSize = sizeof(info);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
66 if (!the_GetMonitorInfo(monitor, &info)) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
67 return FALSE;
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 CopyRect(rect, &(info.rcMonitor));
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
71
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
72 return TRUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
73 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
74
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
75 /**
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
76 * This will only work on Win98+ and Win2K+
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
77 * Return TRUE if successful, otherwise FALSE
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 static gboolean
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
80 get_rect_at_point_multimonitor(POINT pt, RECT *rect) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
81 HMODULE hmod;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
82 purple_MonitorFromPoint *the_MonitorFromPoint;
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
83 HMONITOR monitor;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
84
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
85 if (!(hmod = GetModuleHandle("user32"))) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
86 return FALSE;
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
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
89 if (!(the_MonitorFromPoint = (purple_MonitorFromPoint*)
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
90 GetProcAddress(hmod, "MonitorFromPoint"))) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
91 return FALSE;
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 monitor =
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
95 the_MonitorFromPoint(pt, MONITOR_DEFAULTTOPRIMARY);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
96
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
97 return get_rect_from_monitor(hmod, monitor, rect);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
98 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
99
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
100 /**
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
101 * This will only work on Win98+ and Win2K+
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
102 * Return TRUE if successful, otherwise FALSE
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 static gboolean
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
105 get_rect_of_window_multimonitor(HWND window, RECT *rect) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
106 HMODULE hmod;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
107 purple_MonitorFromWindow *the_MonitorFromWindow;
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
108 HMONITOR monitor;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
109
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
110 if (!(hmod = GetModuleHandle("user32"))) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
111 return FALSE;
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
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
114 if (!(the_MonitorFromWindow = (purple_MonitorFromWindow*)
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
115 GetProcAddress(hmod, "MonitorFromWindow"))) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
116 return FALSE;
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 monitor =
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
120 the_MonitorFromWindow(window, MONITOR_DEFAULTTOPRIMARY);
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 return get_rect_from_monitor(hmod, monitor, rect);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
123 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
124
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
125 /*
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
126 * Fallback if cannot get the RECT from the monitor directly
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
127 */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
128 static void get_default_workarea(RECT *rect) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
129 if (!SystemParametersInfo(SPI_GETWORKAREA, 0, &rect, FALSE)) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
130 /* I don't think this will ever happen */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
131 rect->left = 0;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
132 rect->top = 0;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
133 rect->bottom = GetSystemMetrics(SM_CYSCREEN);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
134 rect->right = GetSystemMetrics(SM_CXSCREEN);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
135 }
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 /* 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
139 static void get_rect_at_point(POINT pt, RECT *rc) {
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
140 if (!get_rect_at_point_multimonitor(pt, rc)) {
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
141 get_default_workarea(rc);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
142 }
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 /* 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
146 static void get_rect_of_window(HWND window, RECT *rc) {
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
147 if (!get_rect_of_window_multimonitor(window, rc)) {
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
148 get_default_workarea(rc);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
149 }
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
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
152 static void get_window_normal_rc(HWND hwnd, RECT *rc) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
153 WINDOWPLACEMENT wplc;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
154 GetWindowPlacement(hwnd, &wplc);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
155 CopyRect(rc, &wplc.rcNormalPosition);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
156 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
157 #if 0
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
158 static void print_rect(RECT *rc) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
159 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
160 rc->left, rc->right, rc->top, rc->bottom);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
161 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
162 #endif
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
163 /** 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
164 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
165 LONG style = GetWindowLong(hwnd, GWL_EXSTYLE);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
166
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
167 if(val && !(style & WS_EX_TOOLWINDOW))
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
168 style |= WS_EX_TOOLWINDOW;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
169 else if(!val && style & WS_EX_TOOLWINDOW)
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
170 style &= ~WS_EX_TOOLWINDOW;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
171 else
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
172 return;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
173 SetWindowLong(hwnd, GWL_EXSTYLE, style);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
174 SetWindowPos(hwnd, 0, 0, 0, 0, 0,
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
175 SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 25910
diff changeset
176
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
177 /* 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
178 * 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
179 * SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
180 */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
181 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
182 /** Register the window as an appbar */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
183 static gboolean gtk_appbar_register(GtkAppBar *ab, HWND hwnd) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
184 APPBARDATA 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 abd.cbSize = sizeof(APPBARDATA);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
187 abd.hWnd = hwnd;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
188 abd.uCallbackMessage = APPBAR_CALLBACK;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
189
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
190 ab->registered = SHAppBarMessage(ABM_NEW, &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 return ab->registered;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
193 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
194 /** Unregister the window as an appbar */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
195 static gboolean gtk_appbar_unregister(GtkAppBar *ab, HWND hwnd) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
196 APPBARDATA abd;
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 if(!ab->registered)
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
199 return TRUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
200
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
201 abd.cbSize = sizeof(APPBARDATA);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
202 abd.hWnd = hwnd;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
203
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
204 SHAppBarMessage(ABM_REMOVE, &abd); /** This always returns TRUE */
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 ab->registered = FALSE;
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 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
209 ab->undocking = FALSE;
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
210 ab->docking = FALSE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
211
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
212 return TRUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
213 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
214
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
215 static void gtk_appbar_querypos(GtkAppBar *ab, HWND hwnd, RECT rcWorkspace) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
216 APPBARDATA abd;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
217 guint iWidth = 0;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
218
15697
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
219 if(!ab->registered)
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
220 gtk_appbar_register(ab, hwnd);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
221
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
222 abd.hWnd = hwnd;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
223 abd.cbSize = sizeof(APPBARDATA);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
224 abd.uEdge = ab->side;
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 iWidth = ab->docked_rect.right - ab->docked_rect.left;
15697
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
227
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
228 abd.rc.top = rcWorkspace.top;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
229 abd.rc.bottom = rcWorkspace.bottom;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
230 switch (abd.uEdge)
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
231 {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
232 case ABE_LEFT:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
233 abd.rc.left = rcWorkspace.left;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
234 abd.rc.right = rcWorkspace.left + iWidth;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
235 break;
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 case ABE_RIGHT:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
238 abd.rc.right = rcWorkspace.right;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
239 abd.rc.left = rcWorkspace.right - iWidth;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
240 break;
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
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
243 /* Ask the system for the screen space */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
244 SHAppBarMessage(ABM_QUERYPOS, &abd);
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 switch (abd.uEdge)
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
247 {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
248 case ABE_LEFT:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
249 abd.rc.right = abd.rc.left + iWidth;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
250 break;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
251
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
252 case ABE_RIGHT:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
253 abd.rc.left = abd.rc.right - iWidth;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
254 break;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
255 }
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 CopyRect(&(ab->docked_rect), &abd.rc);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
258 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
259 /* Actually set the size and screen location of the appbar */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
260 static void gtk_appbar_setpos(GtkAppBar *ab, HWND hwnd) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
261 APPBARDATA abd;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
262
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
263 if(!ab->registered)
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
264 gtk_appbar_register(ab, hwnd);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
265
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
266 abd.hWnd = hwnd;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
267 abd.cbSize = sizeof(APPBARDATA);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
268 CopyRect(&abd.rc, &(ab->docked_rect));
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
269 abd.uEdge = ab->side;
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 SHAppBarMessage(ABM_SETPOS, &abd);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
272 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
273 /** Let any callbacks know that we have docked or undocked */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
274 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
275 GSList *lst = ab->dock_cbs;
14286
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 while(lst) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
278 GtkAppBarDockCB dock_cb = lst->data;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
279 dock_cb(val);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
280 lst = lst->next;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
281 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
282 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
283
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
284 static GdkFilterReturn wnd_moving(GtkAppBar *ab, GdkXEvent *xevent) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
285 MSG *msg = (MSG*)xevent;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
286 POINT cp;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
287 RECT *rc = (RECT*)msg->lParam;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
288 RECT monRect;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
289 int side = -1;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
290 long dockAreaWidth = 0;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
291
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
292 purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "wnd_moving\n");
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
293
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
294 GetCursorPos(&cp);
15697
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
295 get_rect_at_point(cp, &monRect);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
296
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
297 dockAreaWidth = (monRect.right - monRect.left) / 10;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
298 /* Which part of the screen are we in ? */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
299 if (cp.x > (monRect.right - dockAreaWidth)) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
300 side = ABE_RIGHT;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
301 } else if (cp.x < (monRect.left + dockAreaWidth)) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
302 side = ABE_LEFT;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
303 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
304
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
305 if(!ab->docked) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
306 if( (side == ABE_RIGHT || side == ABE_LEFT) ) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
307 if( !ab->docking ) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
308 ab->side = side;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
309 GetWindowRect(msg->hwnd, &(ab->docked_rect));
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
310 gtk_appbar_querypos(ab, msg->hwnd, monRect);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
311
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
312 /* save pre-docking height */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
313 ab->undocked_height = rc->bottom - rc->top;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
314 ab->docking = TRUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
315 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
316 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
317 else
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
318 ab->docking = FALSE;
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 else if(side < 0) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
321 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
322 ab->undocking = TRUE;
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
323 rc->bottom = rc->top + ab->undocked_height;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
324 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
325
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
326 return GDK_FILTER_CONTINUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
327 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
328
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
329 static GdkFilterReturn wnd_sizing(GtkAppBar *ab, GdkXEvent *xevent) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
330 MSG *msg = (MSG*)xevent;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
331
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
332 purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "wnd_sizing\n");
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
333 if(ab->docked) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
334 RECT *rc = (RECT*)msg->lParam;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
335 if(ab->side == ABE_LEFT && msg->wParam == WMSZ_RIGHT) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
336 ab->docked_rect.right = rc->right;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
337 gtk_appbar_setpos(ab, msg->hwnd);
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 else if(ab->side == ABE_RIGHT && msg->wParam == WMSZ_LEFT) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
340 ab->docked_rect.left = rc->left;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
341 gtk_appbar_setpos(ab, msg->hwnd);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
342 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
343 return GDK_FILTER_REMOVE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
344 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
345 return GDK_FILTER_CONTINUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
346 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
347 /** Notify the system that the appbar has been activated */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
348 static GdkFilterReturn wnd_activate(GtkAppBar *ab, GdkXEvent *xevent) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
349 if (ab->registered) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
350 APPBARDATA abd;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
351 MSG *msg = (MSG*)xevent;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
352 purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "wnd_activate\n");
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
353
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
354 abd.hWnd = msg->hwnd;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
355 abd.cbSize = sizeof(APPBARDATA);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
356
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
357 SHAppBarMessage(ABM_ACTIVATE, &abd);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
358 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
359 return GDK_FILTER_CONTINUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
360 }
20846
370ee55e1acb Undock/Redock the buddy list based on the SWP_SHOWWINDOW and SWP_HIDEWINDOW attributes in a WM_WINDOWPOSCHANGING message. This doesn't appear to have any negative effects and makes Pidgin play nicer with the VirtuaWin virtual desktop manager. Fixes #2997.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
361
370ee55e1acb Undock/Redock the buddy list based on the SWP_SHOWWINDOW and SWP_HIDEWINDOW attributes in a WM_WINDOWPOSCHANGING message. This doesn't appear to have any negative effects and makes Pidgin play nicer with the VirtuaWin virtual desktop manager. Fixes #2997.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
362 static void show_hide(GtkAppBar *ab, gboolean hide) {
370ee55e1acb Undock/Redock the buddy list based on the SWP_SHOWWINDOW and SWP_HIDEWINDOW attributes in a WM_WINDOWPOSCHANGING message. This doesn't appear to have any negative effects and makes Pidgin play nicer with the VirtuaWin virtual desktop manager. Fixes #2997.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
363 purple_debug_info("gtkappbar", "show_hide(%d)\n", hide);
370ee55e1acb Undock/Redock the buddy list based on the SWP_SHOWWINDOW and SWP_HIDEWINDOW attributes in a WM_WINDOWPOSCHANGING message. This doesn't appear to have any negative effects and makes Pidgin play nicer with the VirtuaWin virtual desktop manager. Fixes #2997.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
364
370ee55e1acb Undock/Redock the buddy list based on the SWP_SHOWWINDOW and SWP_HIDEWINDOW attributes in a WM_WINDOWPOSCHANGING message. This doesn't appear to have any negative effects and makes Pidgin play nicer with the VirtuaWin virtual desktop manager. Fixes #2997.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
365 if (hide) {
370ee55e1acb Undock/Redock the buddy list based on the SWP_SHOWWINDOW and SWP_HIDEWINDOW attributes in a WM_WINDOWPOSCHANGING message. This doesn't appear to have any negative effects and makes Pidgin play nicer with the VirtuaWin virtual desktop manager. Fixes #2997.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
366 purple_debug_info("gtkappbar", "hidden\n");
35896
bfee243ed8b1 cross-win32: fix gtk3 build
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 31294
diff changeset
367 gtk_appbar_unregister(ab, appbar_get_handle(ab));
20846
370ee55e1acb Undock/Redock the buddy list based on the SWP_SHOWWINDOW and SWP_HIDEWINDOW attributes in a WM_WINDOWPOSCHANGING message. This doesn't appear to have any negative effects and makes Pidgin play nicer with the VirtuaWin virtual desktop manager. Fixes #2997.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
368 ab->docked = TRUE;
370ee55e1acb Undock/Redock the buddy list based on the SWP_SHOWWINDOW and SWP_HIDEWINDOW attributes in a WM_WINDOWPOSCHANGING message. This doesn't appear to have any negative effects and makes Pidgin play nicer with the VirtuaWin virtual desktop manager. Fixes #2997.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
369 ab->iconized = TRUE;
370ee55e1acb Undock/Redock the buddy list based on the SWP_SHOWWINDOW and SWP_HIDEWINDOW attributes in a WM_WINDOWPOSCHANGING message. This doesn't appear to have any negative effects and makes Pidgin play nicer with the VirtuaWin virtual desktop manager. Fixes #2997.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
370 } else {
370ee55e1acb Undock/Redock the buddy list based on the SWP_SHOWWINDOW and SWP_HIDEWINDOW attributes in a WM_WINDOWPOSCHANGING message. This doesn't appear to have any negative effects and makes Pidgin play nicer with the VirtuaWin virtual desktop manager. Fixes #2997.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
371 ab->iconized = FALSE;
370ee55e1acb Undock/Redock the buddy list based on the SWP_SHOWWINDOW and SWP_HIDEWINDOW attributes in a WM_WINDOWPOSCHANGING message. This doesn't appear to have any negative effects and makes Pidgin play nicer with the VirtuaWin virtual desktop manager. Fixes #2997.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
372 purple_debug_info("gtkappbar", "shown\n");
370ee55e1acb Undock/Redock the buddy list based on the SWP_SHOWWINDOW and SWP_HIDEWINDOW attributes in a WM_WINDOWPOSCHANGING message. This doesn't appear to have any negative effects and makes Pidgin play nicer with the VirtuaWin virtual desktop manager. Fixes #2997.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
373 ab->docked = FALSE;
370ee55e1acb Undock/Redock the buddy list based on the SWP_SHOWWINDOW and SWP_HIDEWINDOW attributes in a WM_WINDOWPOSCHANGING message. This doesn't appear to have any negative effects and makes Pidgin play nicer with the VirtuaWin virtual desktop manager. Fixes #2997.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
374 gtk_appbar_do_dock(ab, ab->side);
370ee55e1acb Undock/Redock the buddy list based on the SWP_SHOWWINDOW and SWP_HIDEWINDOW attributes in a WM_WINDOWPOSCHANGING message. This doesn't appear to have any negative effects and makes Pidgin play nicer with the VirtuaWin virtual desktop manager. Fixes #2997.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
375 }
370ee55e1acb Undock/Redock the buddy list based on the SWP_SHOWWINDOW and SWP_HIDEWINDOW attributes in a WM_WINDOWPOSCHANGING message. This doesn't appear to have any negative effects and makes Pidgin play nicer with the VirtuaWin virtual desktop manager. Fixes #2997.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
376
370ee55e1acb Undock/Redock the buddy list based on the SWP_SHOWWINDOW and SWP_HIDEWINDOW attributes in a WM_WINDOWPOSCHANGING message. This doesn't appear to have any negative effects and makes Pidgin play nicer with the VirtuaWin virtual desktop manager. Fixes #2997.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
377 }
370ee55e1acb Undock/Redock the buddy list based on the SWP_SHOWWINDOW and SWP_HIDEWINDOW attributes in a WM_WINDOWPOSCHANGING message. This doesn't appear to have any negative effects and makes Pidgin play nicer with the VirtuaWin virtual desktop manager. Fixes #2997.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
378
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
379 /** Notify the system that the appbar's position has changed */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
380 static GdkFilterReturn wnd_poschanged(GtkAppBar *ab, GdkXEvent *xevent) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
381 if (ab->registered) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
382 APPBARDATA abd;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
383 MSG *msg = (MSG*)xevent;
20846
370ee55e1acb Undock/Redock the buddy list based on the SWP_SHOWWINDOW and SWP_HIDEWINDOW attributes in a WM_WINDOWPOSCHANGING message. This doesn't appear to have any negative effects and makes Pidgin play nicer with the VirtuaWin virtual desktop manager. Fixes #2997.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
384
25910
d24c4a9d28f2 Changing debug levels. These messages fire every single time a window changes focus, making debugging anything else impossible
Casey Ho <caseyho@pidgin.im>
parents: 20846
diff changeset
385 purple_debug(PURPLE_DEBUG_MISC, "gtkappbar", "wnd_poschanged\n");
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
386
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
387 abd.hWnd = msg->hwnd;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
388 abd.cbSize = sizeof(APPBARDATA);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
389
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
390 SHAppBarMessage(ABM_WINDOWPOSCHANGED, &abd);
20846
370ee55e1acb Undock/Redock the buddy list based on the SWP_SHOWWINDOW and SWP_HIDEWINDOW attributes in a WM_WINDOWPOSCHANGING message. This doesn't appear to have any negative effects and makes Pidgin play nicer with the VirtuaWin virtual desktop manager. Fixes #2997.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
391
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
392 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
393 return GDK_FILTER_CONTINUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
394 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
395 /** The window is about to change */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
396 static GdkFilterReturn wnd_poschanging(GtkAppBar *ab, GdkXEvent *xevent) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
397 MSG *msg = (MSG*)xevent;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
398 WINDOWPOS *wpos = (WINDOWPOS*)msg->lParam;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
399
25910
d24c4a9d28f2 Changing debug levels. These messages fire every single time a window changes focus, making debugging anything else impossible
Casey Ho <caseyho@pidgin.im>
parents: 20846
diff changeset
400 purple_debug(PURPLE_DEBUG_MISC, "gtkappbar", "wnd_poschanging\n");
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
401
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
402 if(ab->docked || ab->docking) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
403 wpos->x = ab->docked_rect.left;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
404 wpos->y = ab->docked_rect.top;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
405 wpos->cx = ab->docked_rect.right - ab->docked_rect.left;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
406 wpos->cy = ab->docked_rect.bottom - ab->docked_rect.top;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
407 if(IsIconic(msg->hwnd))
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
408 set_toolbar(msg->hwnd, FALSE);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
409 /*return GDK_FILTER_REMOVE;*/
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
410 }
20846
370ee55e1acb Undock/Redock the buddy list based on the SWP_SHOWWINDOW and SWP_HIDEWINDOW attributes in a WM_WINDOWPOSCHANGING message. This doesn't appear to have any negative effects and makes Pidgin play nicer with the VirtuaWin virtual desktop manager. Fixes #2997.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
411
370ee55e1acb Undock/Redock the buddy list based on the SWP_SHOWWINDOW and SWP_HIDEWINDOW attributes in a WM_WINDOWPOSCHANGING message. This doesn't appear to have any negative effects and makes Pidgin play nicer with the VirtuaWin virtual desktop manager. Fixes #2997.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
412 if (ab->docked) {
370ee55e1acb Undock/Redock the buddy list based on the SWP_SHOWWINDOW and SWP_HIDEWINDOW attributes in a WM_WINDOWPOSCHANGING message. This doesn't appear to have any negative effects and makes Pidgin play nicer with the VirtuaWin virtual desktop manager. Fixes #2997.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
413 if (ab->iconized && wpos->flags & SWP_SHOWWINDOW)
370ee55e1acb Undock/Redock the buddy list based on the SWP_SHOWWINDOW and SWP_HIDEWINDOW attributes in a WM_WINDOWPOSCHANGING message. This doesn't appear to have any negative effects and makes Pidgin play nicer with the VirtuaWin virtual desktop manager. Fixes #2997.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
414 show_hide(ab, FALSE);
370ee55e1acb Undock/Redock the buddy list based on the SWP_SHOWWINDOW and SWP_HIDEWINDOW attributes in a WM_WINDOWPOSCHANGING message. This doesn't appear to have any negative effects and makes Pidgin play nicer with the VirtuaWin virtual desktop manager. Fixes #2997.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
415 else if (!ab->iconized && wpos->flags & SWP_HIDEWINDOW)
370ee55e1acb Undock/Redock the buddy list based on the SWP_SHOWWINDOW and SWP_HIDEWINDOW attributes in a WM_WINDOWPOSCHANGING message. This doesn't appear to have any negative effects and makes Pidgin play nicer with the VirtuaWin virtual desktop manager. Fixes #2997.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
416 show_hide(ab, TRUE);
370ee55e1acb Undock/Redock the buddy list based on the SWP_SHOWWINDOW and SWP_HIDEWINDOW attributes in a WM_WINDOWPOSCHANGING message. This doesn't appear to have any negative effects and makes Pidgin play nicer with the VirtuaWin virtual desktop manager. Fixes #2997.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
417 }
370ee55e1acb Undock/Redock the buddy list based on the SWP_SHOWWINDOW and SWP_HIDEWINDOW attributes in a WM_WINDOWPOSCHANGING message. This doesn't appear to have any negative effects and makes Pidgin play nicer with the VirtuaWin virtual desktop manager. Fixes #2997.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
418
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
419 return GDK_FILTER_CONTINUE;
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
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
422 static GdkFilterReturn wnd_exitsizemove(GtkAppBar *ab, GdkXEvent *xevent) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
423 MSG *msg = (MSG*)xevent;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
424
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
425 purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "wnd_exitsizemove\n");
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
426 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
427 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
428 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
429 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
430 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
431 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
432 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
433 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
434 } 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
435 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
436 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
437 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
438 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
439 ab->undocking = FALSE;
14286
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 return GDK_FILTER_CONTINUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
443 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
444
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
445 static GdkFilterReturn wnd_showwindow(GtkAppBar *ab, GdkXEvent *xevent) {
20846
370ee55e1acb Undock/Redock the buddy list based on the SWP_SHOWWINDOW and SWP_HIDEWINDOW attributes in a WM_WINDOWPOSCHANGING message. This doesn't appear to have any negative effects and makes Pidgin play nicer with the VirtuaWin virtual desktop manager. Fixes #2997.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
446 MSG *msg = (MSG*)xevent;
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
447
20846
370ee55e1acb Undock/Redock the buddy list based on the SWP_SHOWWINDOW and SWP_HIDEWINDOW attributes in a WM_WINDOWPOSCHANGING message. This doesn't appear to have any negative effects and makes Pidgin play nicer with the VirtuaWin virtual desktop manager. Fixes #2997.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
448 purple_debug_info("gtkappbar", "wnd_showwindow\n");
370ee55e1acb Undock/Redock the buddy list based on the SWP_SHOWWINDOW and SWP_HIDEWINDOW attributes in a WM_WINDOWPOSCHANGING message. This doesn't appear to have any negative effects and makes Pidgin play nicer with the VirtuaWin virtual desktop manager. Fixes #2997.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
449 if(msg->wParam && ab->docked) {
370ee55e1acb Undock/Redock the buddy list based on the SWP_SHOWWINDOW and SWP_HIDEWINDOW attributes in a WM_WINDOWPOSCHANGING message. This doesn't appear to have any negative effects and makes Pidgin play nicer with the VirtuaWin virtual desktop manager. Fixes #2997.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
450 show_hide(ab, FALSE);
370ee55e1acb Undock/Redock the buddy list based on the SWP_SHOWWINDOW and SWP_HIDEWINDOW attributes in a WM_WINDOWPOSCHANGING message. This doesn't appear to have any negative effects and makes Pidgin play nicer with the VirtuaWin virtual desktop manager. Fixes #2997.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
451 } else if(!msg->wParam && ab->docked) {
370ee55e1acb Undock/Redock the buddy list based on the SWP_SHOWWINDOW and SWP_HIDEWINDOW attributes in a WM_WINDOWPOSCHANGING message. This doesn't appear to have any negative effects and makes Pidgin play nicer with the VirtuaWin virtual desktop manager. Fixes #2997.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
452 show_hide(ab, TRUE);
370ee55e1acb Undock/Redock the buddy list based on the SWP_SHOWWINDOW and SWP_HIDEWINDOW attributes in a WM_WINDOWPOSCHANGING message. This doesn't appear to have any negative effects and makes Pidgin play nicer with the VirtuaWin virtual desktop manager. Fixes #2997.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
453 }
370ee55e1acb Undock/Redock the buddy list based on the SWP_SHOWWINDOW and SWP_HIDEWINDOW attributes in a WM_WINDOWPOSCHANGING message. This doesn't appear to have any negative effects and makes Pidgin play nicer with the VirtuaWin virtual desktop manager. Fixes #2997.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
454 return GDK_FILTER_CONTINUE;
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
455 }
20846
370ee55e1acb Undock/Redock the buddy list based on the SWP_SHOWWINDOW and SWP_HIDEWINDOW attributes in a WM_WINDOWPOSCHANGING message. This doesn't appear to have any negative effects and makes Pidgin play nicer with the VirtuaWin virtual desktop manager. Fixes #2997.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
456
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
457 /** The window's size has changed */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
458 static GdkFilterReturn wnd_size(GtkAppBar *ab, GdkXEvent *xevent) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
459 MSG *msg = (MSG*)xevent;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
460
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
461 purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "wnd_size\n");
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
462
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
463 if(msg->wParam == SIZE_MINIMIZED) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
464 purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "Minimize\n");
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
465 if(ab->docked) {
35896
bfee243ed8b1 cross-win32: fix gtk3 build
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 31294
diff changeset
466 gtk_appbar_unregister(ab, appbar_get_handle(ab));
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
467 ab->docked = TRUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
468 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
469 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
470 else if(msg->wParam == SIZE_RESTORED) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
471 purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "Restore\n");
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
472 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
473 gtk_appbar_do_dock(ab, ab->side);
14286
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 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
476 return GDK_FILTER_CONTINUE;
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
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
479 static GdkFilterReturn wnd_nchittest(GtkAppBar *ab, GdkXEvent *xevent) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
480 MSG *msg = (MSG*)xevent;
15697
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
481
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
482 if(ab->docked) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
483 UINT ret = DefWindowProc(msg->hwnd, msg->message, msg->wParam, msg->lParam);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
484
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
485 switch(ret) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
486 case HTBOTTOM:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
487 case HTBOTTOMLEFT:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
488 case HTBOTTOMRIGHT:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
489 case HTTOP:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
490 case HTTOPLEFT:
15697
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
491 case HTTOPRIGHT:
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
492 return GDK_FILTER_REMOVE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
493 case HTLEFT:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
494 if(ab->side == ABE_LEFT)
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
495 return GDK_FILTER_REMOVE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
496 break;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
497 case HTRIGHT:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
498 if(ab->side == ABE_RIGHT)
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
499 return GDK_FILTER_REMOVE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
500 break;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
501 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
502 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
503 return GDK_FILTER_CONTINUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
504 }
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 #if 0
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
507 static GdkFilterReturn wnd_initmenupopup(GtkAppBar *ab, GdkXEvent *xevent) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
508 MSG *msg = (MSG*)xevent;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
509
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
510 if(ab->docked && HIWORD(msg->lParam)) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
511 HMENU sysmenu = GetSystemMenu(msg->hwnd, FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
512 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
513 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
514 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
515 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
516 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
517 return GDK_FILTER_CONTINUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
518 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
519 else
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
520 GetSystemMenu(msg->hwnd, TRUE);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
521 return GDK_FILTER_CONTINUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
522 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
523 #endif
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
524
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
525 static GdkFilterReturn gtk_appbar_callback(GtkAppBar *ab, GdkXEvent *xevent) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
526 MSG *msg = (MSG*)xevent;
15697
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
527 RECT orig, windowRect;
14286
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 switch (msg->wParam) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
530 case ABN_STATECHANGE:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
531 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
532 break;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
533
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
534 case ABN_FULLSCREENAPP:
25910
d24c4a9d28f2 Changing debug levels. These messages fire every single time a window changes focus, making debugging anything else impossible
Casey Ho <caseyho@pidgin.im>
parents: 20846
diff changeset
535 purple_debug(PURPLE_DEBUG_MISC, "gtkappbar", "gtk_appbar_callback: ABN_FULLSCREENAPP: %d\n", (BOOL)msg->lParam);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
536 if (!ab->iconized && ab->docked) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
537 if ((BOOL)msg->lParam) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
538 SetWindowPos(msg->hwnd, HWND_BOTTOM, 0, 0, 0, 0,
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
539 SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
540 } else {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
541 SetWindowPos(msg->hwnd, HWND_NOTOPMOST, 0, 0, 0, 0,
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
542 SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_FRAMECHANGED);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
543 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
544 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
545
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
546 break;
15697
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
547 case ABN_POSCHANGED:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
548 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
549 CopyRect(&orig, &(ab->docked_rect));
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
550 get_rect_of_window(msg->hwnd, &windowRect);
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
551 gtk_appbar_querypos(ab, msg->hwnd, windowRect);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
552 if (EqualRect(&orig, &(ab->docked_rect)) == 0) {
15697
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
553 MoveWindow(msg->hwnd, ab->docked_rect.left, ab->docked_rect.top,
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
554 ab->docked_rect.right - ab->docked_rect.left,
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
555 ab->docked_rect.bottom - ab->docked_rect.top, TRUE);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
556 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
557 gtk_appbar_setpos(ab, msg->hwnd);
15697
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
558 break;
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
559 #if 0
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
560 default:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
561 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
562 #endif
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
563 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
564 return GDK_FILTER_CONTINUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
565 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
566
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
567 static GdkFilterReturn gtk_appbar_event_filter(GdkXEvent *xevent, GdkEvent *event, gpointer data) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
568 MSG *msg = (MSG*)xevent;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
569
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
570 /*printf("MSG: %s\n", message_to_string (msg->message));*/
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
571 switch(msg->message) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
572 case WM_EXITSIZEMOVE:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
573 return wnd_exitsizemove(data, xevent);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
574 case WM_WINDOWPOSCHANGING:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
575 return wnd_poschanging(data, xevent);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
576 case WM_WINDOWPOSCHANGED:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
577 return wnd_poschanged(data, xevent);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
578 case WM_ACTIVATE:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
579 return wnd_activate(data, xevent);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
580 case WM_SIZING:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
581 return wnd_sizing(data, xevent);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
582 case WM_MOVING:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
583 return wnd_moving(data, xevent);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
584 case WM_SHOWWINDOW:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
585 return wnd_showwindow(data, xevent);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
586 case WM_NCHITTEST:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
587 return wnd_nchittest(data, xevent);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
588 #if 0
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
589 case WM_INITMENUPOPUP:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
590 return wnd_initmenupopup(data, xevent);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
591 #endif
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
592 case WM_SIZE:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
593 return wnd_size(data, xevent);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
594 case APPBAR_CALLBACK:
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
595 return gtk_appbar_callback(data, xevent);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
596 #if 0
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
597 default:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
598 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
599 #endif
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
600 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
601 return GDK_FILTER_CONTINUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
602 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
603
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
604 static void gtk_appbar_do_dock(GtkAppBar *ab, UINT side) {
15697
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
605 RECT orig, windowRect;
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
606
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
607 purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "gtk_appbar_do_dock\n");
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
608
35896
bfee243ed8b1 cross-win32: fix gtk3 build
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 31294
diff changeset
609 if (!ab || !IsWindow(appbar_get_handle(ab)))
bfee243ed8b1 cross-win32: fix gtk3 build
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 31294
diff changeset
610 return;
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
611
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
612 ab->side = side;
35896
bfee243ed8b1 cross-win32: fix gtk3 build
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 31294
diff changeset
613 get_window_normal_rc(appbar_get_handle(ab), &(ab->docked_rect));
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
614 CopyRect(&orig, &(ab->docked_rect));
35896
bfee243ed8b1 cross-win32: fix gtk3 build
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 31294
diff changeset
615 get_rect_of_window(appbar_get_handle(ab), &windowRect);
bfee243ed8b1 cross-win32: fix gtk3 build
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 31294
diff changeset
616 gtk_appbar_querypos(ab, appbar_get_handle(ab), windowRect);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
617 if(EqualRect(&orig, &(ab->docked_rect)) == 0)
35896
bfee243ed8b1 cross-win32: fix gtk3 build
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 31294
diff changeset
618 MoveWindow(appbar_get_handle(ab),
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
619 ab->docked_rect.left,
15697
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
620 ab->docked_rect.top,
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
621 ab->docked_rect.right - ab->docked_rect.left,
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
622 ab->docked_rect.bottom - ab->docked_rect.top, TRUE);
35896
bfee243ed8b1 cross-win32: fix gtk3 build
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 31294
diff changeset
623 gtk_appbar_setpos(ab, appbar_get_handle(ab));
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
624 ab->docked = TRUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
625 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
626
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
627 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
628 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
629
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
630 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
631
35896
bfee243ed8b1 cross-win32: fix gtk3 build
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 31294
diff changeset
632 hwnd = appbar_get_handle(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
633
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
634 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
635
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
636 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
637
13e591244b33 Fix the docked buddy list to consistently not have a taskbar entry thanks to some tips from "imiganai." This took *way* too long because of how arcane dealing with Windows on Windows is (the unnecessary complexity of our gtkappbar implementation doesn't help). Hopefully this doesn't break anything. Fixes #575.
Daniel Atallah <datallah@pidgin.im>
parents: 15884
diff changeset
638 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
639 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
640 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
641 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
642 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
643 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
644 }
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
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
646 void gtk_appbar_add_dock_cb(GtkAppBar *ab, GtkAppBarDockCB dock_cb) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
647 if(!ab)
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
648 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
649 ab->dock_cbs = g_slist_prepend(ab->dock_cbs, dock_cb);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
650 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
651
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
652 GtkAppBar *gtk_appbar_add(GtkWidget *win) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
653 GtkAppBar *ab;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
654
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
655 purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "gtk_appbar_add\n");
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
656
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
657 if(!win)
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
658 return NULL;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
659 ab = g_new0(GtkAppBar, 1);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
660 ab->win = win;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
661
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
662 /* init docking coords */
35896
bfee243ed8b1 cross-win32: fix gtk3 build
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 31294
diff changeset
663 get_window_normal_rc(appbar_get_handle(ab), &(ab->docked_rect));
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
664
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
665 /* Add main window filter */
35896
bfee243ed8b1 cross-win32: fix gtk3 build
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 31294
diff changeset
666 gdk_window_add_filter(gtk_widget_get_window(win),
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
667 gtk_appbar_event_filter,
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
668 ab);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
669 return ab;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
670 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
671
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
672 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
673 HWND hwnd;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
674 purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "gtk_appbar_remove\n");
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
675
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
676 if(!ab)
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
677 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
678
35896
bfee243ed8b1 cross-win32: fix gtk3 build
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 31294
diff changeset
679 hwnd = appbar_get_handle(ab);
bfee243ed8b1 cross-win32: fix gtk3 build
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 31294
diff changeset
680 gdk_window_remove_filter(gtk_widget_get_window(ab->win),
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
681 gtk_appbar_event_filter,
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
682 ab);
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
683 if(ab->docked) {
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
684 gtk_window_resize(GTK_WINDOW(ab->win),
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
685 ab->docked_rect.right - ab->docked_rect.left,
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
686 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
687 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
688 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
689 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
690 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
691 ShowWindow(hwnd, SW_SHOW);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
692 }
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
693 gtk_appbar_unregister(ab, hwnd);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
694
40079
a37a1e349491 Replace g_[s]list_remove with g_[s]list_delete_link.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 35896
diff changeset
695 g_slist_free(ab->dock_cbs);
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
696
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
697 g_free(ab);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
698 }

mercurial