Mercurial > pidgin
annotate plugins/win32/winprefs/gtkappbar.c @ 10408:f53c59c95f03
[gaim-migrate @ 11656]
I dance through Gaim's code...
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 24 Dec 2004 02:29:24 +0000 |
parents | 719fc957e9ee |
children | 940f0d8ce380 |
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 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
40 static void get_window_normal_rc(HWND hwnd, RECT *rc) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
41 WINDOWPLACEMENT wplc; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
42 GetWindowPlacement(hwnd, &wplc); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
43 CopyRect(rc, &wplc.rcNormalPosition); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
44 } |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
45 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
46 static void print_rect(RECT *rc) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
47 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
|
48 rc->left, rc->right, rc->top, rc->bottom); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
49 } |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
50 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
51 static void set_toolbar(HWND hwnd, gboolean val) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
52 LONG style=0; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
53 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
54 style = GetWindowLong(hwnd, GWL_EXSTYLE); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
55 if(val && !(style & WS_EX_TOOLWINDOW)) |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
56 style |= WS_EX_TOOLWINDOW; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
57 else if(!val && style & WS_EX_TOOLWINDOW) |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
58 style &= ~WS_EX_TOOLWINDOW; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
59 else |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
60 return; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
61 SetWindowLong(hwnd, GWL_EXSTYLE, style); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
62 SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
63 } |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
64 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
65 static gboolean gtk_appbar_register(GtkAppBar *ab, HWND hwnd) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
66 APPBARDATA abd; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
67 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
68 abd.cbSize = sizeof(APPBARDATA); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
69 abd.hWnd = hwnd; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
70 abd.uCallbackMessage = APPBAR_CALLBACK; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
71 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
72 ab->registered = SHAppBarMessage(ABM_NEW, &abd); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
73 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
74 return ab->registered; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
75 } |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
76 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
77 static gboolean gtk_appbar_unregister(GtkAppBar *ab, HWND hwnd) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
78 APPBARDATA abd; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
79 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
80 if(!ab->registered) |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
81 return TRUE; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
82 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
83 abd.cbSize = sizeof(APPBARDATA); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
84 abd.hWnd = hwnd; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
85 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
86 ab->registered = !SHAppBarMessage(ABM_REMOVE, &abd); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
87 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
88 if(!ab->registered) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
89 ab->docked = FALSE; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
90 ab->docking = FALSE; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
91 } |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
92 return !ab->registered; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
93 } |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
94 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
95 static void gtk_appbar_querypos(GtkAppBar *ab, HWND hwnd, RECT *rc) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
96 APPBARDATA abd; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
97 int iWidth = 0; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
98 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
99 if(!ab->registered) |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
100 gtk_appbar_register(ab, hwnd); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
101 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
102 abd.hWnd = hwnd; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
103 abd.cbSize = sizeof(APPBARDATA); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
104 CopyRect(&abd.rc, rc); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
105 abd.uEdge = ab->side; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
106 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
107 iWidth = abd.rc.right - abd.rc.left; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
108 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
109 abd.rc.top = 0; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
110 abd.rc.bottom = GetSystemMetrics(SM_CYSCREEN); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
111 switch (abd.uEdge) |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
112 { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
113 case ABE_LEFT: |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
114 abd.rc.left = 0; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
115 abd.rc.right = iWidth; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
116 break; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
117 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
118 case ABE_RIGHT: |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
119 abd.rc.right = GetSystemMetrics(SM_CXSCREEN); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
120 abd.rc.left = abd.rc.right - iWidth; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
121 break; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
122 } |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
123 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
124 /* Ask the system for the screen space */ |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
125 SHAppBarMessage(ABM_QUERYPOS, &abd); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
126 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
127 switch (abd.uEdge) |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
128 { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
129 case ABE_LEFT: |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
130 abd.rc.right = abd.rc.left + iWidth; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
131 break; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
132 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
133 case ABE_RIGHT: |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
134 abd.rc.left = abd.rc.right - iWidth; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
135 break; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
136 } |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
137 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
138 CopyRect(rc, &abd.rc); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
139 } |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
140 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
141 static void gtk_appbar_setpos(GtkAppBar *ab, HWND hwnd) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
142 APPBARDATA abd; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
143 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
144 if(!ab->registered) |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
145 gtk_appbar_register(ab, hwnd); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
146 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
147 abd.hWnd = hwnd; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
148 abd.cbSize = sizeof(APPBARDATA); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
149 CopyRect(&abd.rc, &(ab->docked_rect)); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
150 abd.uEdge = ab->side; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
151 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
152 SHAppBarMessage(ABM_SETPOS, &abd); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
153 } |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
154 |
6436
759a81390b36
[gaim-migrate @ 6944]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6409
diff
changeset
|
155 static void gtk_appbar_dispatch_dock_cbs(GtkAppBar *ab, gboolean val) { |
759a81390b36
[gaim-migrate @ 6944]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6409
diff
changeset
|
156 GList *lst = ab->dock_cbs; |
759a81390b36
[gaim-migrate @ 6944]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6409
diff
changeset
|
157 |
759a81390b36
[gaim-migrate @ 6944]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6409
diff
changeset
|
158 while(lst) { |
759a81390b36
[gaim-migrate @ 6944]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6409
diff
changeset
|
159 GtkAppBarDockCB dock_cb = lst->data; |
759a81390b36
[gaim-migrate @ 6944]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6409
diff
changeset
|
160 dock_cb(val); |
759a81390b36
[gaim-migrate @ 6944]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6409
diff
changeset
|
161 lst = lst->next; |
759a81390b36
[gaim-migrate @ 6944]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6409
diff
changeset
|
162 } |
759a81390b36
[gaim-migrate @ 6944]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6409
diff
changeset
|
163 } |
759a81390b36
[gaim-migrate @ 6944]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6409
diff
changeset
|
164 |
6409
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
165 static GdkFilterReturn wnd_moving(GtkAppBar *ab, GdkXEvent *xevent) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
166 MSG *msg = (MSG*)xevent; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
167 POINT cp; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
168 LONG cxScreen; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
169 RECT *rc = (RECT*)msg->lParam; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
170 int side = -1; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
171 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
172 gaim_debug(GAIM_DEBUG_INFO, "gtkappbar", "wnd_moving\n"); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
173 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
174 cxScreen = GetSystemMetrics(SM_CXSCREEN); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
175 GetCursorPos(&cp); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
176 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
177 /* Which part of the screen are we in ? */ |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
178 if( cp.x > (cxScreen - (cxScreen / 10)) ) |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
179 side = ABE_RIGHT; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
180 else if( cp.x < (cxScreen / 10) ) |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
181 side = ABE_LEFT; |
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 if(!ab->docked) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
184 if( (side == ABE_RIGHT || side == ABE_LEFT) ) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
185 if( !ab->docking ) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
186 ab->side = side; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
187 GetWindowRect(msg->hwnd, &(ab->docked_rect)); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
188 gtk_appbar_querypos(ab, msg->hwnd, &(ab->docked_rect)); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
189 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
190 /* save pre-docking height */ |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
191 ab->undocked_height = rc->bottom - rc->top; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
192 ab->docking = TRUE; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
193 } |
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 else |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
196 ab->docking = FALSE; |
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 else if(side < 0) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
199 gtk_appbar_unregister(ab, msg->hwnd); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
200 rc->bottom = rc->top + ab->undocked_height; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
201 } |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
202 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
203 /* Switch to toolbar/regular caption*/ |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
204 if(ab->docking) |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
205 set_toolbar(msg->hwnd, TRUE); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
206 else if(!ab->docked) |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
207 set_toolbar(msg->hwnd, FALSE); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
208 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
209 return GDK_FILTER_CONTINUE; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
210 } |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
211 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
212 static GdkFilterReturn wnd_sizing(GtkAppBar *ab, GdkXEvent *xevent) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
213 MSG *msg = (MSG*)xevent; |
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 gaim_debug(GAIM_DEBUG_INFO, "gtkappbar", "wnd_sizing\n"); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
216 if(ab->docked) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
217 RECT *rc = (RECT*)msg->lParam; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
218 if(ab->side == ABE_LEFT && msg->wParam == WMSZ_RIGHT) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
219 ab->docked_rect.right = rc->right; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
220 gtk_appbar_setpos(ab, msg->hwnd); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
221 } |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
222 else if(ab->side == ABE_RIGHT && msg->wParam == WMSZ_LEFT) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
223 ab->docked_rect.left = rc->left; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
224 gtk_appbar_setpos(ab, msg->hwnd); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
225 } |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
226 return GDK_FILTER_REMOVE; |
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 return GDK_FILTER_CONTINUE; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
229 } |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
230 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
231 static GdkFilterReturn wnd_poschanging(GtkAppBar *ab, GdkXEvent *xevent) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
232 MSG *msg = (MSG*)xevent; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
233 WINDOWPOS *wpos = (WINDOWPOS*)msg->lParam; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
234 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
235 gaim_debug(GAIM_DEBUG_INFO, "gtkappbar", "wnd_poschanging\n"); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
236 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
237 if(ab->docked || ab->docking) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
238 wpos->x = ab->docked_rect.left; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
239 wpos->y = ab->docked_rect.top; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
240 wpos->cx = ab->docked_rect.right - ab->docked_rect.left; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
241 wpos->cy = ab->docked_rect.bottom - ab->docked_rect.top; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
242 if(IsIconic(msg->hwnd)) |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
243 set_toolbar(msg->hwnd, FALSE); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
244 /*return GDK_FILTER_REMOVE;*/ |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
245 } |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
246 return GDK_FILTER_CONTINUE; |
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 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
249 static GdkFilterReturn wnd_exitsizemove(GtkAppBar *ab, GdkXEvent *xevent) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
250 MSG *msg = (MSG*)xevent; |
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 if(ab->docking) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
253 gtk_appbar_setpos(ab, msg->hwnd); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
254 ab->docking = FALSE; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
255 ab->docked = TRUE; |
6436
759a81390b36
[gaim-migrate @ 6944]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6409
diff
changeset
|
256 gtk_appbar_dispatch_dock_cbs(ab, TRUE); |
6409
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
257 } |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
258 else if(!ab->docked) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
259 gtk_appbar_unregister(ab, msg->hwnd); |
6436
759a81390b36
[gaim-migrate @ 6944]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6409
diff
changeset
|
260 gtk_appbar_dispatch_dock_cbs(ab, FALSE); |
6409
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 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
263 return GDK_FILTER_CONTINUE; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
264 } |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
265 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
266 static GdkFilterReturn wnd_showwindow(GtkAppBar *ab, GdkXEvent *xevent) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
267 MSG *msg = (MSG*)xevent; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
268 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
269 gaim_debug(GAIM_DEBUG_INFO, "gtkappbar", "wnd_showwindow\n"); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
270 if(msg->wParam && ab->docked) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
271 gaim_debug(GAIM_DEBUG_INFO, "gtkappbar", "shown\n"); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
272 ab->docked = FALSE; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
273 gtk_appbar_dock(ab, ab->side); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
274 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
275 } |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
276 else if(!msg->wParam && ab->docked) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
277 gaim_debug(GAIM_DEBUG_INFO, "gtkappbar", "hidden\n"); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
278 gtk_appbar_unregister(ab, GDK_WINDOW_HWND(ab->win->window)); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
279 set_toolbar(GDK_WINDOW_HWND(ab->win->window), FALSE); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
280 ab->docked = TRUE; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
281 } |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
282 return GDK_FILTER_CONTINUE; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
283 } |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
284 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
285 static GdkFilterReturn wnd_size(GtkAppBar *ab, GdkXEvent *xevent) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
286 MSG *msg = (MSG*)xevent; |
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_size\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 if(msg->wParam == SIZE_MINIMIZED) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
291 gaim_debug(GAIM_DEBUG_INFO, "gtkappbar", "Minimize\n"); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
292 if(ab->docked) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
293 gtk_appbar_unregister(ab, GDK_WINDOW_HWND(ab->win->window)); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
294 ab->docked = TRUE; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
295 } |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
296 } |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
297 else if(msg->wParam == SIZE_RESTORED) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
298 gaim_debug(GAIM_DEBUG_INFO, "gtkappbar", "Restore\n"); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
299 if(ab->docked) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
300 gtk_appbar_dock(ab, ab->side); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
301 } |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
302 } |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
303 return GDK_FILTER_CONTINUE; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
304 } |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
305 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
306 static GdkFilterReturn wnd_nchittest(GtkAppBar *ab, GdkXEvent *xevent) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
307 MSG *msg = (MSG*)xevent; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
308 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
309 if(ab->docked) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
310 UINT ret = DefWindowProc(msg->hwnd, msg->message, msg->wParam, msg->lParam); |
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 switch(ret) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
313 case HTBOTTOM: |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
314 case HTBOTTOMLEFT: |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
315 case HTBOTTOMRIGHT: |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
316 case HTTOP: |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
317 case HTTOPLEFT: |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
318 case HTTOPRIGHT: |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
319 return GDK_FILTER_REMOVE; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
320 case HTLEFT: |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
321 if(ab->side == ABE_LEFT) |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
322 return GDK_FILTER_REMOVE; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
323 break; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
324 case HTRIGHT: |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
325 if(ab->side == ABE_RIGHT) |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
326 return GDK_FILTER_REMOVE; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
327 break; |
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 return GDK_FILTER_CONTINUE; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
331 } |
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 #if 0 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
334 static GdkFilterReturn wnd_initmenupopup(GtkAppBar *ab, GdkXEvent *xevent) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
335 MSG *msg = (MSG*)xevent; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
336 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
337 if(ab->docked && HIWORD(msg->lParam)) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
338 HMENU sysmenu = GetSystemMenu(msg->hwnd, FALSE); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
339 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
|
340 if(EnableMenuItem(sysmenu, SC_MAXIMIZE, MF_BYCOMMAND|MF_GRAYED)<0) |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
341 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
|
342 if(EnableMenuItem(sysmenu, SC_MOVE, MF_BYCOMMAND|MF_GRAYED)<0) |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
343 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
|
344 return GDK_FILTER_CONTINUE; |
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 else |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
347 GetSystemMenu(msg->hwnd, TRUE); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
348 return GDK_FILTER_CONTINUE; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
349 } |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
350 #endif |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
351 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
352 static GdkFilterReturn gtk_appbar_callback(GtkAppBar *ab, GdkXEvent *xevent) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
353 MSG *msg = (MSG*)xevent; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
354 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
355 gaim_debug(GAIM_DEBUG_INFO, "gtkappbar", "gtk_appbar_callback\n"); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
356 switch (msg->wParam) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
357 case ABN_STATECHANGE: |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
358 gaim_debug(GAIM_DEBUG_INFO, "gtkappbar", "gtk_appbar_callback: ABN_STATECHANGE\n"); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
359 break; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
360 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
361 case ABN_FULLSCREENAPP: |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
362 gaim_debug(GAIM_DEBUG_INFO, "gtkappbar", "gtk_appbar_callback: ABN_FULLSCREENAPP: %d\n", (BOOL)msg->lParam); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
363 break; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
364 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
365 case ABN_POSCHANGED: |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
366 gaim_debug(GAIM_DEBUG_INFO, "gtkappbar", "gtk_appbar_callback: ABN_POSCHANGED\n"); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
367 gtk_appbar_querypos(ab, msg->hwnd, &(ab->docked_rect)); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
368 MoveWindow(msg->hwnd, ab->docked_rect.left, ab->docked_rect.top, |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
369 ab->docked_rect.right - ab->docked_rect.left, |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
370 ab->docked_rect.bottom - ab->docked_rect.top, TRUE); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
371 gtk_appbar_setpos(ab, msg->hwnd); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
372 break; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
373 } |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
374 return GDK_FILTER_CONTINUE; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
375 } |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
376 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
377 static GdkFilterReturn gtk_appbar_event_filter(GdkXEvent *xevent, GdkEvent *event, gpointer data) { |
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 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
380 /*printf("MSG: %s\n", message_to_string (msg->message));*/ |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
381 switch(msg->message) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
382 case WM_EXITSIZEMOVE: |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
383 return wnd_exitsizemove(data, xevent); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
384 case WM_WINDOWPOSCHANGING: |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
385 return wnd_poschanging(data, xevent); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
386 case WM_SIZING: |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
387 return wnd_sizing(data, xevent); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
388 case WM_MOVING: |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
389 return wnd_moving(data, xevent); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
390 case WM_SHOWWINDOW: |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
391 return wnd_showwindow(data, xevent); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
392 case WM_NCHITTEST: |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
393 return wnd_nchittest(data, xevent); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
394 #if 0 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
395 case WM_INITMENUPOPUP: |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
396 return wnd_initmenupopup(data, xevent); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
397 #endif |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
398 case WM_SIZE: |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
399 return wnd_size(data, xevent); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
400 case APPBAR_CALLBACK: |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
401 return gtk_appbar_callback(data, xevent); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
402 } |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
403 return GDK_FILTER_CONTINUE; |
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 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
406 void gtk_appbar_dock(GtkAppBar *ab, UINT side) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
407 RECT orig; |
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 gaim_debug(GAIM_DEBUG_INFO, "gtkappbar", "gtk_appbar_dock\n"); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
410 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
411 if(!ab || !IsWindow(GDK_WINDOW_HWND(ab->win->window))) |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
412 return; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
413 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
414 ab->side = side; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
415 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
|
416 CopyRect(&orig, &(ab->docked_rect)); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
417 print_rect(&(ab->docked_rect)); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
418 gtk_appbar_querypos(ab, GDK_WINDOW_HWND(ab->win->window), &(ab->docked_rect)); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
419 if(EqualRect(&orig, &(ab->docked_rect)) == 0) |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
420 MoveWindow(GDK_WINDOW_HWND(ab->win->window), |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
421 ab->docked_rect.left, |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
422 ab->docked_rect.top, |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
423 ab->docked_rect.right - ab->docked_rect.left, |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
424 ab->docked_rect.bottom - ab->docked_rect.top, TRUE); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
425 gtk_appbar_setpos(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), TRUE); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
427 ab->docked = TRUE; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
428 } |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
429 |
6436
759a81390b36
[gaim-migrate @ 6944]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6409
diff
changeset
|
430 void gtk_appbar_add_dock_cb(GtkAppBar *ab, GtkAppBarDockCB dock_cb) { |
759a81390b36
[gaim-migrate @ 6944]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6409
diff
changeset
|
431 if(!ab) |
759a81390b36
[gaim-migrate @ 6944]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6409
diff
changeset
|
432 return; |
759a81390b36
[gaim-migrate @ 6944]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6409
diff
changeset
|
433 ab->dock_cbs = g_list_append(ab->dock_cbs, dock_cb); |
759a81390b36
[gaim-migrate @ 6944]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6409
diff
changeset
|
434 } |
759a81390b36
[gaim-migrate @ 6944]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6409
diff
changeset
|
435 |
6409
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
436 GtkAppBar *gtk_appbar_add(GtkWidget *win) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
437 GtkAppBar *ab; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
438 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
439 gaim_debug(GAIM_DEBUG_INFO, "gtkappbar", "gtk_appbar_add\n"); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
440 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
441 if(!win) |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
442 return NULL; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
443 ab = g_new0(GtkAppBar, 1); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
444 ab->win = win; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
445 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
446 /* init docking coords */ |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
447 get_window_normal_rc(GDK_WINDOW_HWND(win->window), &(ab->docked_rect)); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
448 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
449 /* Add main window filter */ |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
450 gdk_window_add_filter(win->window, |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
451 gtk_appbar_event_filter, |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
452 ab); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
453 return ab; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
454 } |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
455 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
456 void gtk_appbar_remove(GtkAppBar *ab) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
457 gaim_debug(GAIM_DEBUG_INFO, "gtkappbar", "gtk_appbar_remove\n"); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
458 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
459 if(!ab) |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
460 return; |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
461 gdk_window_remove_filter(ab->win->window, |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
462 gtk_appbar_event_filter, |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
463 ab); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
464 if(ab->docked) { |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
465 gtk_window_resize(GTK_WINDOW(ab->win), |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
466 ab->docked_rect.right - ab->docked_rect.left, |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
467 ab->undocked_height); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
468 set_toolbar(GDK_WINDOW_HWND(ab->win->window), FALSE); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
469 } |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
470 gtk_appbar_unregister(ab, GDK_WINDOW_HWND(ab->win->window)); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
471 |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
472 g_free(ab); |
752d0600b514
[gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
473 } |