annotate plugins/win32/winprefs/gtkappbar.c @ 13588:bbf2e601be82

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