Fri, 29 Mar 2019 18:30:03 -0400
Use G_DECLARE* in facebook prpl.
|
6278
d0cd8645bf90
[gaim-migrate @ 6777]
Herman Bloggs <herman@bluedigits.com>
parents:
6261
diff
changeset
|
1 | /* |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15562
diff
changeset
|
2 | * System tray icon (aka docklet) plugin for Winpidgin |
| 6209 | 3 | * |
| 4 | * Copyright (C) 2002-3 Robert McQueen <robot101@debian.org> | |
| 5 | * Copyright (C) 2003 Herman Bloggs <hermanator12002@yahoo.com> | |
| 6 | * Inspired by a similar plugin by: | |
| 7 | * John (J5) Palmieri <johnp@martianrock.com> | |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15562
diff
changeset
|
8 | * |
| 6209 | 9 | * This program is free software; you can redistribute it and/or |
| 10 | * modify it under the terms of the GNU General Public License as | |
| 11 | * published by the Free Software Foundation; either version 2 of the | |
| 12 | * License, or (at your option) any later version. | |
| 13 | * | |
| 14 | * This program is distributed in the hope that it will be useful, but | |
| 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 17 | * General Public License for more details. | |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15562
diff
changeset
|
18 | * |
| 6209 | 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19832
diff
changeset
|
21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19832
diff
changeset
|
22 | * 02111-1301, USA. |
| 6209 | 23 | */ |
|
35892
02bf3200b9cb
cross-win32: make use of WIN32_LEAN_AND_MEAN define
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35891
diff
changeset
|
24 | |
|
02bf3200b9cb
cross-win32: make use of WIN32_LEAN_AND_MEAN define
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35891
diff
changeset
|
25 | #include <config.h> |
|
02bf3200b9cb
cross-win32: make use of WIN32_LEAN_AND_MEAN define
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35891
diff
changeset
|
26 | |
| 6209 | 27 | #include <windows.h> |
| 28 | #include <gdk/gdkwin32.h> | |
| 29 | #include <gdk/gdk.h> | |
| 30 | ||
| 31 | #include "internal.h" | |
| 32 | #include "gtkblist.h" | |
| 33 | #include "debug.h" | |
| 34 | ||
| 35 | #include "resource.h" | |
| 36 | #include "MinimizeToTray.h" | |
|
14286
9ff15ceacd34
[gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
37 | #include "gtkwin32dep.h" |
|
14745
d43256e1e6fd
[gaim-migrate @ 17435]
Daniel Atallah <datallah@pidgin.im>
parents:
14743
diff
changeset
|
38 | #include "gtkdocklet.h" |
|
39500
f8a87f89c735
remove PIDGIN_STOCK from gtkdocklet-win32.c
Gary Kramlich <grim@reaperworld.com>
parents:
38929
diff
changeset
|
39 | #include "pidginicon.h" |
| 6209 | 40 | |
| 41 | /* | |
| 42 | * DEFINES, MACROS & DATA TYPES | |
| 43 | */ | |
| 44 | #define WM_TRAYMESSAGE WM_USER /* User defined WM Message */ | |
| 45 | ||
| 46 | /* | |
| 47 | * LOCALS | |
| 48 | */ | |
|
15765
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
49 | static HWND systray_hwnd = NULL; |
|
16996
749cb2af2e40
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16808
diff
changeset
|
50 | /* additional two cached_icons entries for pending and connecting icons */ |
|
33527
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
31294
diff
changeset
|
51 | static HICON cached_icons[PURPLE_STATUS_NUM_PRIMITIVES + 3]; |
|
15765
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
52 | static GtkWidget *image = NULL; |
|
20142
af8e3a8b68df
applied changes from 0a36aea71847198e73c07cbef0be7e7a7db12c57
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
53 | /* This is used to trigger click events on so they appear to GTK+ as if they are triggered by input */ |
|
af8e3a8b68df
applied changes from 0a36aea71847198e73c07cbef0be7e7a7db12c57
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
54 | static GtkWidget *dummy_button = NULL; |
|
af8e3a8b68df
applied changes from 0a36aea71847198e73c07cbef0be7e7a7db12c57
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
55 | static GtkWidget *dummy_window = NULL; |
|
29819
4c96cfc0636e
Use the Post W2K Windows System Tray icon stuff - allows for 128 chars instead of 64 - also support non-ASCII stuff in the tooltip. Fixes #11461
Daniel Atallah <datallah@pidgin.im>
parents:
29492
diff
changeset
|
56 | static NOTIFYICONDATAW _nicon_data; |
| 6209 | 57 | |
|
20142
af8e3a8b68df
applied changes from 0a36aea71847198e73c07cbef0be7e7a7db12c57
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
58 | static gboolean dummy_button_cb(GtkWidget *widget, GdkEventButton *event, gpointer user_data) { |
|
af8e3a8b68df
applied changes from 0a36aea71847198e73c07cbef0be7e7a7db12c57
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
59 | pidgin_docklet_clicked(event->button); |
|
af8e3a8b68df
applied changes from 0a36aea71847198e73c07cbef0be7e7a7db12c57
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
60 | return TRUE; |
|
af8e3a8b68df
applied changes from 0a36aea71847198e73c07cbef0be7e7a7db12c57
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
61 | } |
|
af8e3a8b68df
applied changes from 0a36aea71847198e73c07cbef0be7e7a7db12c57
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
62 | |
| 6209 | 63 | static LRESULT CALLBACK systray_mainmsg_handler(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { |
| 64 | static UINT taskbarRestartMsg; /* static here means value is kept across multiple calls to this func */ | |
| 65 | ||
| 66 | switch(msg) { | |
| 67 | case WM_CREATE: | |
| 15884 | 68 | purple_debug_info("docklet", "WM_CREATE\n"); |
|
29819
4c96cfc0636e
Use the Post W2K Windows System Tray icon stuff - allows for 128 chars instead of 64 - also support non-ASCII stuff in the tooltip. Fixes #11461
Daniel Atallah <datallah@pidgin.im>
parents:
29492
diff
changeset
|
69 | taskbarRestartMsg = RegisterWindowMessageW(L"TaskbarCreated"); |
| 6209 | 70 | break; |
|
15765
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
71 | |
| 6209 | 72 | case WM_TIMER: |
| 15884 | 73 | purple_debug_info("docklet", "WM_TIMER\n"); |
| 6209 | 74 | break; |
| 75 | ||
| 76 | case WM_DESTROY: | |
| 15884 | 77 | purple_debug_info("docklet", "WM_DESTROY\n"); |
| 6209 | 78 | break; |
| 79 | ||
| 80 | case WM_TRAYMESSAGE: | |
| 81 | { | |
| 82 | int type = 0; | |
|
20142
af8e3a8b68df
applied changes from 0a36aea71847198e73c07cbef0be7e7a7db12c57
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
83 | GdkEvent *event; |
|
af8e3a8b68df
applied changes from 0a36aea71847198e73c07cbef0be7e7a7db12c57
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
84 | GdkEventButton *event_btn; |
| 6209 | 85 | |
| 86 | /* We'll use Double Click - Single click over on linux */ | |
|
14745
d43256e1e6fd
[gaim-migrate @ 17435]
Daniel Atallah <datallah@pidgin.im>
parents:
14743
diff
changeset
|
87 | if(lparam == WM_LBUTTONDBLCLK) |
|
38712
ea49cd76cf47
Use GDK button constants instead of magic numbers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35892
diff
changeset
|
88 | type = GDK_BUTTOM_PRIMARY; |
|
14745
d43256e1e6fd
[gaim-migrate @ 17435]
Daniel Atallah <datallah@pidgin.im>
parents:
14743
diff
changeset
|
89 | else if(lparam == WM_MBUTTONUP) |
|
38712
ea49cd76cf47
Use GDK button constants instead of magic numbers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35892
diff
changeset
|
90 | type = GDK_BUTTON_MIDDLE; |
|
14745
d43256e1e6fd
[gaim-migrate @ 17435]
Daniel Atallah <datallah@pidgin.im>
parents:
14743
diff
changeset
|
91 | else if(lparam == WM_RBUTTONUP) |
|
38712
ea49cd76cf47
Use GDK button constants instead of magic numbers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35892
diff
changeset
|
92 | type = GDK_BUTTON_SECONDARY; |
| 6209 | 93 | else |
| 94 | break; | |
| 95 | ||
|
20142
af8e3a8b68df
applied changes from 0a36aea71847198e73c07cbef0be7e7a7db12c57
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
96 | gtk_widget_show_all(dummy_window); |
|
af8e3a8b68df
applied changes from 0a36aea71847198e73c07cbef0be7e7a7db12c57
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
97 | event = gdk_event_new(GDK_BUTTON_PRESS); |
|
af8e3a8b68df
applied changes from 0a36aea71847198e73c07cbef0be7e7a7db12c57
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
98 | event_btn = (GdkEventButton *) event; |
|
af8e3a8b68df
applied changes from 0a36aea71847198e73c07cbef0be7e7a7db12c57
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
99 | event_btn->window = g_object_ref (gdk_get_default_root_window()); |
|
af8e3a8b68df
applied changes from 0a36aea71847198e73c07cbef0be7e7a7db12c57
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
100 | event_btn->send_event = TRUE; |
|
af8e3a8b68df
applied changes from 0a36aea71847198e73c07cbef0be7e7a7db12c57
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
101 | event_btn->time = GetTickCount(); |
|
af8e3a8b68df
applied changes from 0a36aea71847198e73c07cbef0be7e7a7db12c57
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
102 | event_btn->axes = NULL; |
|
af8e3a8b68df
applied changes from 0a36aea71847198e73c07cbef0be7e7a7db12c57
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
103 | event_btn->state = 0; |
|
af8e3a8b68df
applied changes from 0a36aea71847198e73c07cbef0be7e7a7db12c57
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
104 | event_btn->button = type; |
|
af8e3a8b68df
applied changes from 0a36aea71847198e73c07cbef0be7e7a7db12c57
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
105 | event_btn->device = gdk_display_get_default ()->core_pointer; |
|
af8e3a8b68df
applied changes from 0a36aea71847198e73c07cbef0be7e7a7db12c57
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
106 | event->any.window = g_object_ref(dummy_window->window); |
|
af8e3a8b68df
applied changes from 0a36aea71847198e73c07cbef0be7e7a7db12c57
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
107 | gdk_window_set_user_data(event->any.window, dummy_button); |
|
af8e3a8b68df
applied changes from 0a36aea71847198e73c07cbef0be7e7a7db12c57
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
108 | |
|
af8e3a8b68df
applied changes from 0a36aea71847198e73c07cbef0be7e7a7db12c57
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
109 | gtk_main_do_event((GdkEvent *)event); |
|
af8e3a8b68df
applied changes from 0a36aea71847198e73c07cbef0be7e7a7db12c57
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
110 | gtk_widget_hide(dummy_window); |
|
af8e3a8b68df
applied changes from 0a36aea71847198e73c07cbef0be7e7a7db12c57
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
111 | gdk_event_free((GdkEvent *)event); |
|
af8e3a8b68df
applied changes from 0a36aea71847198e73c07cbef0be7e7a7db12c57
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
112 | |
| 6209 | 113 | break; |
| 114 | } | |
|
14745
d43256e1e6fd
[gaim-migrate @ 17435]
Daniel Atallah <datallah@pidgin.im>
parents:
14743
diff
changeset
|
115 | default: |
| 6209 | 116 | if (msg == taskbarRestartMsg) { |
|
14745
d43256e1e6fd
[gaim-migrate @ 17435]
Daniel Atallah <datallah@pidgin.im>
parents:
14743
diff
changeset
|
117 | /* explorer crashed and left us hanging... |
| 6209 | 118 | This will put the systray icon back in it's place, when it restarts */ |
|
29819
4c96cfc0636e
Use the Post W2K Windows System Tray icon stuff - allows for 128 chars instead of 64 - also support non-ASCII stuff in the tooltip. Fixes #11461
Daniel Atallah <datallah@pidgin.im>
parents:
29492
diff
changeset
|
119 | Shell_NotifyIconW(NIM_ADD, &_nicon_data); |
| 6209 | 120 | } |
| 121 | break; | |
| 122 | }/* end switch */ | |
| 123 | ||
| 124 | return DefWindowProc(hwnd, msg, wparam, lparam); | |
| 125 | } | |
| 126 | ||
| 127 | /* Create hidden window to process systray messages */ | |
| 128 | static HWND systray_create_hiddenwin() { | |
|
29819
4c96cfc0636e
Use the Post W2K Windows System Tray icon stuff - allows for 128 chars instead of 64 - also support non-ASCII stuff in the tooltip. Fixes #11461
Daniel Atallah <datallah@pidgin.im>
parents:
29492
diff
changeset
|
129 | WNDCLASSEXW wcex; |
|
4c96cfc0636e
Use the Post W2K Windows System Tray icon stuff - allows for 128 chars instead of 64 - also support non-ASCII stuff in the tooltip. Fixes #11461
Daniel Atallah <datallah@pidgin.im>
parents:
29492
diff
changeset
|
130 | wchar_t *wname; |
| 6209 | 131 | |
|
29819
4c96cfc0636e
Use the Post W2K Windows System Tray icon stuff - allows for 128 chars instead of 64 - also support non-ASCII stuff in the tooltip. Fixes #11461
Daniel Atallah <datallah@pidgin.im>
parents:
29492
diff
changeset
|
132 | wname = L"WinpidginSystrayWinCls"; |
| 6209 | 133 | |
|
14745
d43256e1e6fd
[gaim-migrate @ 17435]
Daniel Atallah <datallah@pidgin.im>
parents:
14743
diff
changeset
|
134 | wcex.cbSize = sizeof(wcex); |
|
11709
da6e9cd5f6d9
[gaim-migrate @ 14000]
Casey Harkins <charkins@pidgin.im>
parents:
10520
diff
changeset
|
135 | wcex.style = 0; |
|
14745
d43256e1e6fd
[gaim-migrate @ 17435]
Daniel Atallah <datallah@pidgin.im>
parents:
14743
diff
changeset
|
136 | wcex.lpfnWndProc = systray_mainmsg_handler; |
| 6209 | 137 | wcex.cbClsExtra = 0; |
| 138 | wcex.cbWndExtra = 0; | |
|
16058
dc1c7b09a058
4bit icons for windows < XP. These are certainly not as pretty as the originals, but look a lot better than scaled down versions.
Daniel Atallah <datallah@pidgin.im>
parents:
15891
diff
changeset
|
139 | wcex.hInstance = winpidgin_exe_hinstance(); |
| 6209 | 140 | wcex.hIcon = NULL; |
| 141 | wcex.hCursor = NULL, | |
| 142 | wcex.hbrBackground = NULL; | |
| 143 | wcex.lpszMenuName = NULL; | |
| 144 | wcex.lpszClassName = wname; | |
| 145 | wcex.hIconSm = NULL; | |
| 146 | ||
|
29819
4c96cfc0636e
Use the Post W2K Windows System Tray icon stuff - allows for 128 chars instead of 64 - also support non-ASCII stuff in the tooltip. Fixes #11461
Daniel Atallah <datallah@pidgin.im>
parents:
29492
diff
changeset
|
147 | RegisterClassExW(&wcex); |
| 6209 | 148 | |
|
9863
323e4fe28791
[gaim-migrate @ 10742]
Mark Doliner <markdoliner@pidgin.im>
parents:
9709
diff
changeset
|
149 | /* Create the window */ |
|
29819
4c96cfc0636e
Use the Post W2K Windows System Tray icon stuff - allows for 128 chars instead of 64 - also support non-ASCII stuff in the tooltip. Fixes #11461
Daniel Atallah <datallah@pidgin.im>
parents:
29492
diff
changeset
|
150 | return (CreateWindowW(wname, L"", 0, 0, 0, 0, 0, GetDesktopWindow(), NULL, winpidgin_exe_hinstance(), 0)); |
| 6209 | 151 | } |
| 152 | ||
|
15765
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
153 | static void systray_init_icon(HWND hWnd) { |
|
29819
4c96cfc0636e
Use the Post W2K Windows System Tray icon stuff - allows for 128 chars instead of 64 - also support non-ASCII stuff in the tooltip. Fixes #11461
Daniel Atallah <datallah@pidgin.im>
parents:
29492
diff
changeset
|
154 | wchar_t *w; |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15562
diff
changeset
|
155 | ZeroMemory(&_nicon_data, sizeof(_nicon_data)); |
|
29819
4c96cfc0636e
Use the Post W2K Windows System Tray icon stuff - allows for 128 chars instead of 64 - also support non-ASCII stuff in the tooltip. Fixes #11461
Daniel Atallah <datallah@pidgin.im>
parents:
29492
diff
changeset
|
156 | _nicon_data.cbSize = sizeof(NOTIFYICONDATAW); |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15562
diff
changeset
|
157 | _nicon_data.hWnd = hWnd; |
|
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15562
diff
changeset
|
158 | _nicon_data.uID = 0; |
|
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15562
diff
changeset
|
159 | _nicon_data.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP; |
|
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15562
diff
changeset
|
160 | _nicon_data.uCallbackMessage = WM_TRAYMESSAGE; |
|
15765
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
161 | _nicon_data.hIcon = NULL; |
|
29819
4c96cfc0636e
Use the Post W2K Windows System Tray icon stuff - allows for 128 chars instead of 64 - also support non-ASCII stuff in the tooltip. Fixes #11461
Daniel Atallah <datallah@pidgin.im>
parents:
29492
diff
changeset
|
162 | w = g_utf8_to_utf16(PIDGIN_NAME, -1, NULL, NULL, NULL); |
|
4c96cfc0636e
Use the Post W2K Windows System Tray icon stuff - allows for 128 chars instead of 64 - also support non-ASCII stuff in the tooltip. Fixes #11461
Daniel Atallah <datallah@pidgin.im>
parents:
29492
diff
changeset
|
163 | wcsncpy(_nicon_data.szTip, w, sizeof(_nicon_data.szTip) / sizeof(wchar_t)); |
|
4c96cfc0636e
Use the Post W2K Windows System Tray icon stuff - allows for 128 chars instead of 64 - also support non-ASCII stuff in the tooltip. Fixes #11461
Daniel Atallah <datallah@pidgin.im>
parents:
29492
diff
changeset
|
164 | g_free(w); |
|
4c96cfc0636e
Use the Post W2K Windows System Tray icon stuff - allows for 128 chars instead of 64 - also support non-ASCII stuff in the tooltip. Fixes #11461
Daniel Atallah <datallah@pidgin.im>
parents:
29492
diff
changeset
|
165 | Shell_NotifyIconW(NIM_ADD, &_nicon_data); |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15522
diff
changeset
|
166 | pidgin_docklet_embedded(); |
| 6209 | 167 | } |
| 168 | ||
|
15765
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
169 | /* This is ganked from GTK+. |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
170 | * When we can use GTK+ 2.10 and the GtkStatusIcon stuff, this will no longer be necesary */ |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
171 | #define WIN32_GDI_FAILED(api) printf("GDI FAILED %s\n", api) |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
172 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
173 | static gboolean |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
174 | _gdk_win32_pixbuf_to_hicon_supports_alpha (void) |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
175 | { |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
176 | static gboolean is_win_xp=FALSE, is_win_xp_checked=FALSE; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
177 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
178 | if (!is_win_xp_checked) |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
179 | { |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
180 | is_win_xp_checked = TRUE; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
181 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
182 | if (!G_WIN32_IS_NT_BASED ()) |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
183 | is_win_xp = FALSE; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
184 | else |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
185 | { |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
186 | OSVERSIONINFO version; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
187 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
188 | memset (&version, 0, sizeof (version)); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
189 | version.dwOSVersionInfoSize = sizeof (version); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
190 | is_win_xp = GetVersionEx (&version) |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
191 | && version.dwPlatformId == VER_PLATFORM_WIN32_NT |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
192 | && (version.dwMajorVersion > 5 |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
193 | || (version.dwMajorVersion == 5 && version.dwMinorVersion >= 1)); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
194 | } |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
195 | } |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
196 | return is_win_xp; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
197 | } |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
198 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
199 | static HBITMAP |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
200 | create_alpha_bitmap (gint size, |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
201 | guchar **outdata) |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
202 | { |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
203 | BITMAPV5HEADER bi; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
204 | HDC hdc; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
205 | HBITMAP hBitmap; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
206 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
207 | ZeroMemory (&bi, sizeof (BITMAPV5HEADER)); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
208 | bi.bV5Size = sizeof (BITMAPV5HEADER); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
209 | bi.bV5Height = bi.bV5Width = size; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
210 | bi.bV5Planes = 1; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
211 | bi.bV5BitCount = 32; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
212 | bi.bV5Compression = BI_BITFIELDS; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
213 | /* The following mask specification specifies a supported 32 BPP |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
214 | * alpha format for Windows XP (BGRA format). |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
215 | */ |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
216 | bi.bV5RedMask = 0x00FF0000; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
217 | bi.bV5GreenMask = 0x0000FF00; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
218 | bi.bV5BlueMask = 0x000000FF; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
219 | bi.bV5AlphaMask = 0xFF000000; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
220 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
221 | /* Create the DIB section with an alpha channel. */ |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
222 | hdc = GetDC (NULL); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
223 | if (!hdc) |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
224 | { |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
225 | WIN32_GDI_FAILED ("GetDC"); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
226 | return NULL; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
227 | } |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
228 | hBitmap = CreateDIBSection (hdc, (BITMAPINFO *)&bi, DIB_RGB_COLORS, |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
229 | (PVOID *) outdata, NULL, (DWORD)0); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
230 | if (hBitmap == NULL) |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
231 | WIN32_GDI_FAILED ("CreateDIBSection"); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
232 | ReleaseDC (NULL, hdc); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
233 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
234 | return hBitmap; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
235 | } |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
236 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
237 | static HBITMAP |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
238 | create_color_bitmap (gint size, |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
239 | guchar **outdata, |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
240 | gint bits) |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
241 | { |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
242 | struct { |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
243 | BITMAPV4HEADER bmiHeader; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
244 | RGBQUAD bmiColors[2]; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
245 | } bmi; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
246 | HDC hdc; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
247 | HBITMAP hBitmap; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
248 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
249 | ZeroMemory (&bmi, sizeof (bmi)); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
250 | bmi.bmiHeader.bV4Size = sizeof (BITMAPV4HEADER); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
251 | bmi.bmiHeader.bV4Height = bmi.bmiHeader.bV4Width = size; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
252 | bmi.bmiHeader.bV4Planes = 1; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
253 | bmi.bmiHeader.bV4BitCount = bits; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
254 | bmi.bmiHeader.bV4V4Compression = BI_RGB; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
255 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
256 | /* when bits is 1, these will be used. |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
257 | * bmiColors[0] already zeroed from ZeroMemory() |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
258 | */ |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
259 | bmi.bmiColors[1].rgbBlue = 0xFF; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
260 | bmi.bmiColors[1].rgbGreen = 0xFF; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
261 | bmi.bmiColors[1].rgbRed = 0xFF; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
262 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
263 | hdc = GetDC (NULL); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
264 | if (!hdc) |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
265 | { |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
266 | WIN32_GDI_FAILED ("GetDC"); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
267 | return NULL; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
268 | } |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
269 | hBitmap = CreateDIBSection (hdc, (BITMAPINFO *)&bmi, DIB_RGB_COLORS, |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
270 | (PVOID *) outdata, NULL, (DWORD)0); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
271 | if (hBitmap == NULL) |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
272 | WIN32_GDI_FAILED ("CreateDIBSection"); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
273 | ReleaseDC (NULL, hdc); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
274 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
275 | return hBitmap; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
276 | } |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
277 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
278 | static gboolean |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
279 | pixbuf_to_hbitmaps_alpha_winxp (GdkPixbuf *pixbuf, |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
280 | HBITMAP *color, |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
281 | HBITMAP *mask) |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
282 | { |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
283 | /* Based on code from |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
284 | * http://www.dotnet247.com/247reference/msgs/13/66301.aspx |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
285 | */ |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
286 | HBITMAP hColorBitmap, hMaskBitmap; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
287 | guchar *indata, *inrow; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
288 | guchar *colordata, *colorrow, *maskdata, *maskbyte; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
289 | gint width, height, size, i, i_offset, j, j_offset, rowstride; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
290 | guint maskstride, mask_bit; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
291 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
292 | width = gdk_pixbuf_get_width (pixbuf); /* width of icon */ |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
293 | height = gdk_pixbuf_get_height (pixbuf); /* height of icon */ |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
294 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
295 | /* The bitmaps are created square */ |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
296 | size = MAX (width, height); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
297 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
298 | hColorBitmap = create_alpha_bitmap (size, &colordata); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
299 | if (!hColorBitmap) |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
300 | return FALSE; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
301 | hMaskBitmap = create_color_bitmap (size, &maskdata, 1); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
302 | if (!hMaskBitmap) |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
303 | { |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
304 | DeleteObject (hColorBitmap); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
305 | return FALSE; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
306 | } |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
307 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
308 | /* MSDN says mask rows are aligned to "LONG" boundaries */ |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
309 | maskstride = (((size + 31) & ~31) >> 3); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
310 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
311 | indata = gdk_pixbuf_get_pixels (pixbuf); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
312 | rowstride = gdk_pixbuf_get_rowstride (pixbuf); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
313 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
314 | if (width > height) |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
315 | { |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
316 | i_offset = 0; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
317 | j_offset = (width - height) / 2; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
318 | } |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
319 | else |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
320 | { |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
321 | i_offset = (height - width) / 2; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
322 | j_offset = 0; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
323 | } |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
324 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
325 | for (j = 0; j < height; j++) |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
326 | { |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
327 | colorrow = colordata + 4*(j+j_offset)*size + 4*i_offset; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
328 | maskbyte = maskdata + (j+j_offset)*maskstride + i_offset/8; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
329 | mask_bit = (0x80 >> (i_offset % 8)); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
330 | inrow = indata + (height-j-1)*rowstride; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
331 | for (i = 0; i < width; i++) |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
332 | { |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
333 | colorrow[4*i+0] = inrow[4*i+2]; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
334 | colorrow[4*i+1] = inrow[4*i+1]; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
335 | colorrow[4*i+2] = inrow[4*i+0]; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
336 | colorrow[4*i+3] = inrow[4*i+3]; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
337 | if (inrow[4*i+3] == 0) |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
338 | maskbyte[0] |= mask_bit; /* turn ON bit */ |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
339 | else |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
340 | maskbyte[0] &= ~mask_bit; /* turn OFF bit */ |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
341 | mask_bit >>= 1; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
342 | if (mask_bit == 0) |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
343 | { |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
344 | mask_bit = 0x80; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
345 | maskbyte++; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
346 | } |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
347 | } |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
348 | } |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
349 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
350 | *color = hColorBitmap; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
351 | *mask = hMaskBitmap; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
352 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
353 | return TRUE; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
354 | } |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
355 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
356 | static gboolean |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
357 | pixbuf_to_hbitmaps_normal (GdkPixbuf *pixbuf, |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
358 | HBITMAP *color, |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
359 | HBITMAP *mask) |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
360 | { |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
361 | /* Based on code from |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
362 | * http://www.dotnet247.com/247reference/msgs/13/66301.aspx |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
363 | */ |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
364 | HBITMAP hColorBitmap, hMaskBitmap; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
365 | guchar *indata, *inrow; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
366 | guchar *colordata, *colorrow, *maskdata, *maskbyte; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
367 | gint width, height, size, i, i_offset, j, j_offset, rowstride, nc, bmstride; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
368 | gboolean has_alpha; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
369 | guint maskstride, mask_bit; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
370 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
371 | width = gdk_pixbuf_get_width (pixbuf); /* width of icon */ |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
372 | height = gdk_pixbuf_get_height (pixbuf); /* height of icon */ |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
373 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
374 | /* The bitmaps are created square */ |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
375 | size = MAX (width, height); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
376 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
377 | hColorBitmap = create_color_bitmap (size, &colordata, 24); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
378 | if (!hColorBitmap) |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
379 | return FALSE; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
380 | hMaskBitmap = create_color_bitmap (size, &maskdata, 1); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
381 | if (!hMaskBitmap) |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
382 | { |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
383 | DeleteObject (hColorBitmap); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
384 | return FALSE; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
385 | } |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
386 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
387 | /* rows are always aligned on 4-byte boundarys */ |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
388 | bmstride = size * 3; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
389 | if (bmstride % 4 != 0) |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
390 | bmstride += 4 - (bmstride % 4); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
391 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
392 | /* MSDN says mask rows are aligned to "LONG" boundaries */ |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
393 | maskstride = (((size + 31) & ~31) >> 3); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
394 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
395 | indata = gdk_pixbuf_get_pixels (pixbuf); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
396 | rowstride = gdk_pixbuf_get_rowstride (pixbuf); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
397 | nc = gdk_pixbuf_get_n_channels (pixbuf); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
398 | has_alpha = gdk_pixbuf_get_has_alpha (pixbuf); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
399 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
400 | if (width > height) |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
401 | { |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
402 | i_offset = 0; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
403 | j_offset = (width - height) / 2; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
404 | } |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
405 | else |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
406 | { |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
407 | i_offset = (height - width) / 2; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
408 | j_offset = 0; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
409 | } |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
410 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
411 | for (j = 0; j < height; j++) |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
412 | { |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
413 | colorrow = colordata + (j+j_offset)*bmstride + 3*i_offset; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
414 | maskbyte = maskdata + (j+j_offset)*maskstride + i_offset/8; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
415 | mask_bit = (0x80 >> (i_offset % 8)); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
416 | inrow = indata + (height-j-1)*rowstride; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
417 | for (i = 0; i < width; i++) |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
418 | { |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
419 | if (has_alpha && inrow[nc*i+3] < 128) |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
420 | { |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
421 | colorrow[3*i+0] = colorrow[3*i+1] = colorrow[3*i+2] = 0; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
422 | maskbyte[0] |= mask_bit; /* turn ON bit */ |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
423 | } |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
424 | else |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
425 | { |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
426 | colorrow[3*i+0] = inrow[nc*i+2]; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
427 | colorrow[3*i+1] = inrow[nc*i+1]; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
428 | colorrow[3*i+2] = inrow[nc*i+0]; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
429 | maskbyte[0] &= ~mask_bit; /* turn OFF bit */ |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
430 | } |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
431 | mask_bit >>= 1; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
432 | if (mask_bit == 0) |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
433 | { |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
434 | mask_bit = 0x80; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
435 | maskbyte++; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
436 | } |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
437 | } |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
438 | } |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
439 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
440 | *color = hColorBitmap; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
441 | *mask = hMaskBitmap; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
442 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
443 | return TRUE; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
444 | } |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
445 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
446 | static HICON |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
447 | pixbuf_to_hicon (GdkPixbuf *pixbuf) |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
448 | { |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
449 | gint x = 0, y = 0; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
450 | gboolean is_icon = TRUE; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
451 | ICONINFO ii; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
452 | HICON icon; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
453 | gboolean success; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
454 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
455 | if (pixbuf == NULL) |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
456 | return NULL; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
457 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
458 | if (_gdk_win32_pixbuf_to_hicon_supports_alpha() && gdk_pixbuf_get_has_alpha (pixbuf)) |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
459 | success = pixbuf_to_hbitmaps_alpha_winxp (pixbuf, &ii.hbmColor, &ii.hbmMask); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
460 | else |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
461 | success = pixbuf_to_hbitmaps_normal (pixbuf, &ii.hbmColor, &ii.hbmMask); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
462 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
463 | if (!success) |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
464 | return NULL; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
465 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
466 | ii.fIcon = is_icon; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
467 | ii.xHotspot = x; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
468 | ii.yHotspot = y; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
469 | icon = CreateIconIndirect (&ii); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
470 | DeleteObject (ii.hbmColor); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
471 | DeleteObject (ii.hbmMask); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
472 | return icon; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
473 | } |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
474 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
475 | static HICON load_hicon_from_stock(const char *stock) { |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
476 | HICON hicon = NULL; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
477 | GdkPixbuf *pixbuf = gtk_widget_render_icon(image, stock, |
|
15834
ba09306a7b0a
16px tray icons. These are used if the tray is shorter than 22px, and in Windows where all tray icons are 16x16. I still need to attach to a resizing signal to make them automatically update when the tray resizes.
Sean Egan <seanegan@pidgin.im>
parents:
15774
diff
changeset
|
478 | gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL), NULL); |
|
15765
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
479 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
480 | if (pixbuf) { |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
481 | hicon = pixbuf_to_hicon(pixbuf); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
482 | g_object_unref(pixbuf); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
483 | } else |
|
19832
84b69b21672b
Patch from QuLogic. Fixes #2903 ('Missing newlines in debug messages.')
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16996
diff
changeset
|
484 | purple_debug_error("docklet", "Unable to load pixbuf for %s.\n", stock); |
|
15765
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
485 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
486 | return hicon; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
487 | } |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
488 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
489 | |
|
15770
e0454c66f042
Cache the converted docklet HICONs. Sean noticed that there are actually .ico files in pixmaps/tray/16 (something that I missed). I'm not sure if I should just use those and eliminate the stock pixmap to HICON conversion hackery or if we can just get rid of those and avoid the duplication.
Daniel Atallah <datallah@pidgin.im>
parents:
15765
diff
changeset
|
490 | static void systray_change_icon(HICON hicon) { |
|
15765
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
491 | g_return_if_fail(hicon != NULL); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
492 | |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
493 | _nicon_data.hIcon = hicon; |
|
29819
4c96cfc0636e
Use the Post W2K Windows System Tray icon stuff - allows for 128 chars instead of 64 - also support non-ASCII stuff in the tooltip. Fixes #11461
Daniel Atallah <datallah@pidgin.im>
parents:
29492
diff
changeset
|
494 | Shell_NotifyIconW(NIM_MODIFY, &_nicon_data); |
| 6209 | 495 | } |
| 496 | ||
| 497 | static void systray_remove_nid(void) { | |
|
29819
4c96cfc0636e
Use the Post W2K Windows System Tray icon stuff - allows for 128 chars instead of 64 - also support non-ASCII stuff in the tooltip. Fixes #11461
Daniel Atallah <datallah@pidgin.im>
parents:
29492
diff
changeset
|
498 | Shell_NotifyIconW(NIM_DELETE, &_nicon_data); |
| 6209 | 499 | } |
| 500 | ||
|
16996
749cb2af2e40
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16808
diff
changeset
|
501 | static void winpidgin_tray_update_icon(PurpleStatusPrimitive status, |
|
33527
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
31294
diff
changeset
|
502 | PidginDockletFlag flags) { |
|
16996
749cb2af2e40
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16808
diff
changeset
|
503 | |
|
749cb2af2e40
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16808
diff
changeset
|
504 | int icon_index; |
|
749cb2af2e40
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16808
diff
changeset
|
505 | g_return_if_fail(image != NULL); |
|
15765
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
506 | |
|
33527
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
31294
diff
changeset
|
507 | if(flags & PIDGIN_DOCKLET_CONNECTING) |
|
16996
749cb2af2e40
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16808
diff
changeset
|
508 | icon_index = PURPLE_STATUS_NUM_PRIMITIVES; |
|
33527
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
31294
diff
changeset
|
509 | else if(flags & PIDGIN_DOCKLET_EMAIL_PENDING) |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
31294
diff
changeset
|
510 | icon_index = PURPLE_STATUS_NUM_PRIMITIVES+2; |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
31294
diff
changeset
|
511 | else if(flags & PIDGIN_DOCKLET_CONV_PENDING) |
|
16996
749cb2af2e40
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16808
diff
changeset
|
512 | icon_index = PURPLE_STATUS_NUM_PRIMITIVES+1; |
|
749cb2af2e40
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16808
diff
changeset
|
513 | else |
|
749cb2af2e40
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16808
diff
changeset
|
514 | icon_index = status; |
|
749cb2af2e40
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16808
diff
changeset
|
515 | |
|
749cb2af2e40
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16808
diff
changeset
|
516 | g_return_if_fail(icon_index < (sizeof(cached_icons) / sizeof(HICON))); |
|
15765
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
517 | |
|
15770
e0454c66f042
Cache the converted docklet HICONs. Sean noticed that there are actually .ico files in pixmaps/tray/16 (something that I missed). I'm not sure if I should just use those and eliminate the stock pixmap to HICON conversion hackery or if we can just get rid of those and avoid the duplication.
Daniel Atallah <datallah@pidgin.im>
parents:
15765
diff
changeset
|
518 | /* Look up and cache the HICON if we don't already have it */ |
|
16996
749cb2af2e40
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16808
diff
changeset
|
519 | if (cached_icons[icon_index] == NULL) { |
|
15770
e0454c66f042
Cache the converted docklet HICONs. Sean noticed that there are actually .ico files in pixmaps/tray/16 (something that I missed). I'm not sure if I should just use those and eliminate the stock pixmap to HICON conversion hackery or if we can just get rid of those and avoid the duplication.
Daniel Atallah <datallah@pidgin.im>
parents:
15765
diff
changeset
|
520 | const gchar *icon_name = NULL; |
|
39500
f8a87f89c735
remove PIDGIN_STOCK from gtkdocklet-win32.c
Gary Kramlich <grim@reaperworld.com>
parents:
38929
diff
changeset
|
521 | |
|
f8a87f89c735
remove PIDGIN_STOCK from gtkdocklet-win32.c
Gary Kramlich <grim@reaperworld.com>
parents:
38929
diff
changeset
|
522 | icon_name = pidgin_status_icon_from_primitive(status); |
|
15770
e0454c66f042
Cache the converted docklet HICONs. Sean noticed that there are actually .ico files in pixmaps/tray/16 (something that I missed). I'm not sure if I should just use those and eliminate the stock pixmap to HICON conversion hackery or if we can just get rid of those and avoid the duplication.
Daniel Atallah <datallah@pidgin.im>
parents:
15765
diff
changeset
|
523 | |
|
33527
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
31294
diff
changeset
|
524 | if (flags & PIDGIN_DOCKLET_EMAIL_PENDING) |
|
39503
6672def34858
Fix some issues found in review
Gary Kramlich <grim@reaperworld.com>
parents:
39500
diff
changeset
|
525 | icon_name = PIDGIN_ICON_MAIL_NEW; |
|
33527
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
31294
diff
changeset
|
526 | else if (flags & PIDGIN_DOCKLET_CONV_PENDING) |
|
39500
f8a87f89c735
remove PIDGIN_STOCK from gtkdocklet-win32.c
Gary Kramlich <grim@reaperworld.com>
parents:
38929
diff
changeset
|
527 | icon_name = PIDGIN_ICON_MESSAGE_NEW; |
|
33527
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
31294
diff
changeset
|
528 | else if (flags & PIDGIN_DOCKLET_CONNECTING) |
|
39500
f8a87f89c735
remove PIDGIN_STOCK from gtkdocklet-win32.c
Gary Kramlich <grim@reaperworld.com>
parents:
38929
diff
changeset
|
529 | icon_name = PIDGIN_ICON_CONNECT; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
29819
diff
changeset
|
530 | |
|
15770
e0454c66f042
Cache the converted docklet HICONs. Sean noticed that there are actually .ico files in pixmaps/tray/16 (something that I missed). I'm not sure if I should just use those and eliminate the stock pixmap to HICON conversion hackery or if we can just get rid of those and avoid the duplication.
Daniel Atallah <datallah@pidgin.im>
parents:
15765
diff
changeset
|
531 | g_return_if_fail(icon_name != NULL); |
|
e0454c66f042
Cache the converted docklet HICONs. Sean noticed that there are actually .ico files in pixmaps/tray/16 (something that I missed). I'm not sure if I should just use those and eliminate the stock pixmap to HICON conversion hackery or if we can just get rid of those and avoid the duplication.
Daniel Atallah <datallah@pidgin.im>
parents:
15765
diff
changeset
|
532 | |
|
16996
749cb2af2e40
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16808
diff
changeset
|
533 | cached_icons[icon_index] = load_hicon_from_stock(icon_name); |
| 6209 | 534 | } |
|
15765
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
535 | |
|
16996
749cb2af2e40
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16808
diff
changeset
|
536 | systray_change_icon(cached_icons[icon_index]); |
| 6209 | 537 | } |
| 538 | ||
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15562
diff
changeset
|
539 | static void winpidgin_tray_blank_icon() { |
|
15765
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
540 | _nicon_data.hIcon = NULL; |
|
29819
4c96cfc0636e
Use the Post W2K Windows System Tray icon stuff - allows for 128 chars instead of 64 - also support non-ASCII stuff in the tooltip. Fixes #11461
Daniel Atallah <datallah@pidgin.im>
parents:
29492
diff
changeset
|
541 | Shell_NotifyIconW(NIM_MODIFY, &_nicon_data); |
|
12471
5d7c12d525ed
[gaim-migrate @ 14781]
Casey Harkins <charkins@pidgin.im>
parents:
12016
diff
changeset
|
542 | } |
|
5d7c12d525ed
[gaim-migrate @ 14781]
Casey Harkins <charkins@pidgin.im>
parents:
12016
diff
changeset
|
543 | |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15562
diff
changeset
|
544 | static void winpidgin_tray_set_tooltip(gchar *tooltip) { |
|
29819
4c96cfc0636e
Use the Post W2K Windows System Tray icon stuff - allows for 128 chars instead of 64 - also support non-ASCII stuff in the tooltip. Fixes #11461
Daniel Atallah <datallah@pidgin.im>
parents:
29492
diff
changeset
|
545 | const char *value = tooltip; |
|
4c96cfc0636e
Use the Post W2K Windows System Tray icon stuff - allows for 128 chars instead of 64 - also support non-ASCII stuff in the tooltip. Fixes #11461
Daniel Atallah <datallah@pidgin.im>
parents:
29492
diff
changeset
|
546 | wchar_t *w; |
|
4c96cfc0636e
Use the Post W2K Windows System Tray icon stuff - allows for 128 chars instead of 64 - also support non-ASCII stuff in the tooltip. Fixes #11461
Daniel Atallah <datallah@pidgin.im>
parents:
29492
diff
changeset
|
547 | if (value == NULL) { |
|
4c96cfc0636e
Use the Post W2K Windows System Tray icon stuff - allows for 128 chars instead of 64 - also support non-ASCII stuff in the tooltip. Fixes #11461
Daniel Atallah <datallah@pidgin.im>
parents:
29492
diff
changeset
|
548 | value = PIDGIN_NAME; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
29819
diff
changeset
|
549 | } |
|
29819
4c96cfc0636e
Use the Post W2K Windows System Tray icon stuff - allows for 128 chars instead of 64 - also support non-ASCII stuff in the tooltip. Fixes #11461
Daniel Atallah <datallah@pidgin.im>
parents:
29492
diff
changeset
|
550 | w = g_utf8_to_utf16(value, -1, NULL, NULL, NULL); |
|
4c96cfc0636e
Use the Post W2K Windows System Tray icon stuff - allows for 128 chars instead of 64 - also support non-ASCII stuff in the tooltip. Fixes #11461
Daniel Atallah <datallah@pidgin.im>
parents:
29492
diff
changeset
|
551 | wcsncpy(_nicon_data.szTip, w, sizeof(_nicon_data.szTip) / sizeof(wchar_t)); |
|
4c96cfc0636e
Use the Post W2K Windows System Tray icon stuff - allows for 128 chars instead of 64 - also support non-ASCII stuff in the tooltip. Fixes #11461
Daniel Atallah <datallah@pidgin.im>
parents:
29492
diff
changeset
|
552 | g_free(w); |
|
4c96cfc0636e
Use the Post W2K Windows System Tray icon stuff - allows for 128 chars instead of 64 - also support non-ASCII stuff in the tooltip. Fixes #11461
Daniel Atallah <datallah@pidgin.im>
parents:
29492
diff
changeset
|
553 | Shell_NotifyIconW(NIM_MODIFY, &_nicon_data); |
|
6894
8c6e286b079d
[gaim-migrate @ 7441]
Herman Bloggs <herman@bluedigits.com>
parents:
6425
diff
changeset
|
554 | } |
|
8c6e286b079d
[gaim-migrate @ 7441]
Herman Bloggs <herman@bluedigits.com>
parents:
6425
diff
changeset
|
555 | |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15562
diff
changeset
|
556 | static void winpidgin_tray_minimize(PidginBuddyList *gtkblist) { |
|
12016
0517ad5d0196
[gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents:
11709
diff
changeset
|
557 | MinimizeWndToTray(GDK_WINDOW_HWND(gtkblist->window->window)); |
|
0517ad5d0196
[gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents:
11709
diff
changeset
|
558 | } |
|
0517ad5d0196
[gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents:
11709
diff
changeset
|
559 | |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15562
diff
changeset
|
560 | static void winpidgin_tray_maximize(PidginBuddyList *gtkblist) { |
|
12016
0517ad5d0196
[gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents:
11709
diff
changeset
|
561 | RestoreWndFromTray(GDK_WINDOW_HWND(gtkblist->window->window)); |
|
0517ad5d0196
[gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents:
11709
diff
changeset
|
562 | } |
|
0517ad5d0196
[gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents:
11709
diff
changeset
|
563 | |
|
0517ad5d0196
[gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents:
11709
diff
changeset
|
564 | |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15562
diff
changeset
|
565 | static void winpidgin_tray_create() { |
|
16058
dc1c7b09a058
4bit icons for windows < XP. These are certainly not as pretty as the originals, but look a lot better than scaled down versions.
Daniel Atallah <datallah@pidgin.im>
parents:
15891
diff
changeset
|
566 | OSVERSIONINFO osinfo; |
| 6209 | 567 | /* dummy window to process systray messages */ |
| 568 | systray_hwnd = systray_create_hiddenwin(); | |
| 569 | ||
|
20142
af8e3a8b68df
applied changes from 0a36aea71847198e73c07cbef0be7e7a7db12c57
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
570 | dummy_window = gtk_window_new(GTK_WINDOW_POPUP); |
|
af8e3a8b68df
applied changes from 0a36aea71847198e73c07cbef0be7e7a7db12c57
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
571 | dummy_button = gtk_button_new(); |
|
af8e3a8b68df
applied changes from 0a36aea71847198e73c07cbef0be7e7a7db12c57
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
572 | gtk_container_add(GTK_CONTAINER(dummy_window), dummy_button); |
|
af8e3a8b68df
applied changes from 0a36aea71847198e73c07cbef0be7e7a7db12c57
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
573 | |
|
af8e3a8b68df
applied changes from 0a36aea71847198e73c07cbef0be7e7a7db12c57
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
574 | /* We trigger the click event indirectly so that gtk_get_current_event_state() is TRUE when the event is handled */ |
|
af8e3a8b68df
applied changes from 0a36aea71847198e73c07cbef0be7e7a7db12c57
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
575 | g_signal_connect(G_OBJECT(dummy_button), "button-press-event", |
|
af8e3a8b68df
applied changes from 0a36aea71847198e73c07cbef0be7e7a7db12c57
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
576 | G_CALLBACK(dummy_button_cb), NULL); |
|
af8e3a8b68df
applied changes from 0a36aea71847198e73c07cbef0be7e7a7db12c57
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
577 | |
|
15765
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
578 | image = gtk_image_new(); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
579 | g_object_ref_sink(image); |
| 6209 | 580 | |
|
16058
dc1c7b09a058
4bit icons for windows < XP. These are certainly not as pretty as the originals, but look a lot better than scaled down versions.
Daniel Atallah <datallah@pidgin.im>
parents:
15891
diff
changeset
|
581 | osinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); |
|
dc1c7b09a058
4bit icons for windows < XP. These are certainly not as pretty as the originals, but look a lot better than scaled down versions.
Daniel Atallah <datallah@pidgin.im>
parents:
15891
diff
changeset
|
582 | GetVersionEx(&osinfo); |
|
dc1c7b09a058
4bit icons for windows < XP. These are certainly not as pretty as the originals, but look a lot better than scaled down versions.
Daniel Atallah <datallah@pidgin.im>
parents:
15891
diff
changeset
|
583 | |
|
dc1c7b09a058
4bit icons for windows < XP. These are certainly not as pretty as the originals, but look a lot better than scaled down versions.
Daniel Atallah <datallah@pidgin.im>
parents:
15891
diff
changeset
|
584 | /* Load icons, and init systray notify icon |
|
dc1c7b09a058
4bit icons for windows < XP. These are certainly not as pretty as the originals, but look a lot better than scaled down versions.
Daniel Atallah <datallah@pidgin.im>
parents:
15891
diff
changeset
|
585 | * NOTE: Windows < XP only supports displaying 4-bit images in the Systray, |
|
dc1c7b09a058
4bit icons for windows < XP. These are certainly not as pretty as the originals, but look a lot better than scaled down versions.
Daniel Atallah <datallah@pidgin.im>
parents:
15891
diff
changeset
|
586 | * 2K and ME will use the highest color depth that the desktop will support, |
|
dc1c7b09a058
4bit icons for windows < XP. These are certainly not as pretty as the originals, but look a lot better than scaled down versions.
Daniel Atallah <datallah@pidgin.im>
parents:
15891
diff
changeset
|
587 | * but will scale it back to 4-bits for display. |
|
dc1c7b09a058
4bit icons for windows < XP. These are certainly not as pretty as the originals, but look a lot better than scaled down versions.
Daniel Atallah <datallah@pidgin.im>
parents:
15891
diff
changeset
|
588 | * That is why we use custom 4-bit icons for pre XP Windowses */ |
|
dc1c7b09a058
4bit icons for windows < XP. These are certainly not as pretty as the originals, but look a lot better than scaled down versions.
Daniel Atallah <datallah@pidgin.im>
parents:
15891
diff
changeset
|
589 | if (osinfo.dwMajorVersion < 5 || (osinfo.dwMajorVersion == 5 && osinfo.dwMinorVersion == 0)) |
|
dc1c7b09a058
4bit icons for windows < XP. These are certainly not as pretty as the originals, but look a lot better than scaled down versions.
Daniel Atallah <datallah@pidgin.im>
parents:
15891
diff
changeset
|
590 | { |
|
16996
749cb2af2e40
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16808
diff
changeset
|
591 | cached_icons[PURPLE_STATUS_OFFLINE] = (HICON) LoadImage(winpidgin_dll_hinstance(), |
|
16058
dc1c7b09a058
4bit icons for windows < XP. These are certainly not as pretty as the originals, but look a lot better than scaled down versions.
Daniel Atallah <datallah@pidgin.im>
parents:
15891
diff
changeset
|
592 | MAKEINTRESOURCE(PIDGIN_TRAY_OFFLINE_4BIT), IMAGE_ICON, 16, 16, LR_CREATEDIBSECTION); |
|
16996
749cb2af2e40
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16808
diff
changeset
|
593 | cached_icons[PURPLE_STATUS_AVAILABLE] = (HICON) LoadImage(winpidgin_dll_hinstance(), |
|
16058
dc1c7b09a058
4bit icons for windows < XP. These are certainly not as pretty as the originals, but look a lot better than scaled down versions.
Daniel Atallah <datallah@pidgin.im>
parents:
15891
diff
changeset
|
594 | MAKEINTRESOURCE(PIDGIN_TRAY_AVAILABLE_4BIT), IMAGE_ICON, 16, 16, LR_CREATEDIBSECTION); |
|
16996
749cb2af2e40
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16808
diff
changeset
|
595 | cached_icons[PURPLE_STATUS_AWAY] = (HICON) LoadImage(winpidgin_dll_hinstance(), |
|
16058
dc1c7b09a058
4bit icons for windows < XP. These are certainly not as pretty as the originals, but look a lot better than scaled down versions.
Daniel Atallah <datallah@pidgin.im>
parents:
15891
diff
changeset
|
596 | MAKEINTRESOURCE(PIDGIN_TRAY_AWAY_4BIT), IMAGE_ICON, 16, 16, LR_CREATEDIBSECTION); |
|
16996
749cb2af2e40
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16808
diff
changeset
|
597 | cached_icons[PURPLE_STATUS_EXTENDED_AWAY] = (HICON) LoadImage(winpidgin_dll_hinstance(), |
|
16058
dc1c7b09a058
4bit icons for windows < XP. These are certainly not as pretty as the originals, but look a lot better than scaled down versions.
Daniel Atallah <datallah@pidgin.im>
parents:
15891
diff
changeset
|
598 | MAKEINTRESOURCE(PIDGIN_TRAY_XA_4BIT), IMAGE_ICON, 16, 16, LR_CREATEDIBSECTION); |
|
16996
749cb2af2e40
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16808
diff
changeset
|
599 | cached_icons[PURPLE_STATUS_UNAVAILABLE] = (HICON) LoadImage(winpidgin_dll_hinstance(), |
|
16058
dc1c7b09a058
4bit icons for windows < XP. These are certainly not as pretty as the originals, but look a lot better than scaled down versions.
Daniel Atallah <datallah@pidgin.im>
parents:
15891
diff
changeset
|
600 | MAKEINTRESOURCE(PIDGIN_TRAY_BUSY_4BIT), IMAGE_ICON, 16, 16, LR_CREATEDIBSECTION); |
|
16996
749cb2af2e40
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16808
diff
changeset
|
601 | cached_icons[PURPLE_STATUS_NUM_PRIMITIVES] = (HICON) LoadImage(winpidgin_dll_hinstance(), |
|
16058
dc1c7b09a058
4bit icons for windows < XP. These are certainly not as pretty as the originals, but look a lot better than scaled down versions.
Daniel Atallah <datallah@pidgin.im>
parents:
15891
diff
changeset
|
602 | MAKEINTRESOURCE(PIDGIN_TRAY_CONNECTING_4BIT), IMAGE_ICON, 16, 16, LR_CREATEDIBSECTION); |
|
16996
749cb2af2e40
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16808
diff
changeset
|
603 | cached_icons[PURPLE_STATUS_NUM_PRIMITIVES+1] = (HICON) LoadImage(winpidgin_dll_hinstance(), |
|
16058
dc1c7b09a058
4bit icons for windows < XP. These are certainly not as pretty as the originals, but look a lot better than scaled down versions.
Daniel Atallah <datallah@pidgin.im>
parents:
15891
diff
changeset
|
604 | MAKEINTRESOURCE(PIDGIN_TRAY_PENDING_4BIT), IMAGE_ICON, 16, 16, LR_CREATEDIBSECTION); |
|
16996
749cb2af2e40
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16808
diff
changeset
|
605 | cached_icons[PURPLE_STATUS_INVISIBLE] = (HICON) LoadImage(winpidgin_dll_hinstance(), |
| 16808 | 606 | MAKEINTRESOURCE(PIDGIN_TRAY_INVISIBLE_4BIT), IMAGE_ICON, 16, 16, LR_CREATEDIBSECTION); |
|
16058
dc1c7b09a058
4bit icons for windows < XP. These are certainly not as pretty as the originals, but look a lot better than scaled down versions.
Daniel Atallah <datallah@pidgin.im>
parents:
15891
diff
changeset
|
607 | } |
|
dc1c7b09a058
4bit icons for windows < XP. These are certainly not as pretty as the originals, but look a lot better than scaled down versions.
Daniel Atallah <datallah@pidgin.im>
parents:
15891
diff
changeset
|
608 | |
| 6209 | 609 | /* Create icon in systray */ |
|
15765
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
610 | systray_init_icon(systray_hwnd); |
|
12016
0517ad5d0196
[gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents:
11709
diff
changeset
|
611 | |
| 15884 | 612 | purple_signal_connect(pidgin_blist_get_handle(), "gtkblist-hiding", |
| 613 | pidgin_docklet_get_handle(), PURPLE_CALLBACK(winpidgin_tray_minimize), NULL); | |
| 614 | purple_signal_connect(pidgin_blist_get_handle(), "gtkblist-unhiding", | |
| 615 | pidgin_docklet_get_handle(), PURPLE_CALLBACK(winpidgin_tray_maximize), NULL); | |
|
12016
0517ad5d0196
[gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents:
11709
diff
changeset
|
616 | |
| 15884 | 617 | purple_debug_info("docklet", "created\n"); |
| 6209 | 618 | } |
| 619 | ||
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15562
diff
changeset
|
620 | static void winpidgin_tray_destroy() { |
|
15770
e0454c66f042
Cache the converted docklet HICONs. Sean noticed that there are actually .ico files in pixmaps/tray/16 (something that I missed). I'm not sure if I should just use those and eliminate the stock pixmap to HICON conversion hackery or if we can just get rid of those and avoid the duplication.
Daniel Atallah <datallah@pidgin.im>
parents:
15765
diff
changeset
|
621 | int cached_cnt = sizeof(cached_icons) / sizeof(HICON); |
| 6209 | 622 | systray_remove_nid(); |
|
22687
3cb9f701d421
printf format warning fixes.
Daniel Atallah <datallah@pidgin.im>
parents:
20962
diff
changeset
|
623 | |
|
3cb9f701d421
printf format warning fixes.
Daniel Atallah <datallah@pidgin.im>
parents:
20962
diff
changeset
|
624 | purple_signals_disconnect_by_handle(pidgin_docklet_get_handle()); |
|
3cb9f701d421
printf format warning fixes.
Daniel Atallah <datallah@pidgin.im>
parents:
20962
diff
changeset
|
625 | |
| 6209 | 626 | DestroyWindow(systray_hwnd); |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15522
diff
changeset
|
627 | pidgin_docklet_remove(); |
|
15765
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
628 | |
|
15770
e0454c66f042
Cache the converted docklet HICONs. Sean noticed that there are actually .ico files in pixmaps/tray/16 (something that I missed). I'm not sure if I should just use those and eliminate the stock pixmap to HICON conversion hackery or if we can just get rid of those and avoid the duplication.
Daniel Atallah <datallah@pidgin.im>
parents:
15765
diff
changeset
|
629 | while (--cached_cnt >= 0) { |
|
e0454c66f042
Cache the converted docklet HICONs. Sean noticed that there are actually .ico files in pixmaps/tray/16 (something that I missed). I'm not sure if I should just use those and eliminate the stock pixmap to HICON conversion hackery or if we can just get rid of those and avoid the duplication.
Daniel Atallah <datallah@pidgin.im>
parents:
15765
diff
changeset
|
630 | if (cached_icons[cached_cnt] != NULL) |
|
e0454c66f042
Cache the converted docklet HICONs. Sean noticed that there are actually .ico files in pixmaps/tray/16 (something that I missed). I'm not sure if I should just use those and eliminate the stock pixmap to HICON conversion hackery or if we can just get rid of those and avoid the duplication.
Daniel Atallah <datallah@pidgin.im>
parents:
15765
diff
changeset
|
631 | DestroyIcon(cached_icons[cached_cnt]); |
|
e0454c66f042
Cache the converted docklet HICONs. Sean noticed that there are actually .ico files in pixmaps/tray/16 (something that I missed). I'm not sure if I should just use those and eliminate the stock pixmap to HICON conversion hackery or if we can just get rid of those and avoid the duplication.
Daniel Atallah <datallah@pidgin.im>
parents:
15765
diff
changeset
|
632 | cached_icons[cached_cnt] = NULL; |
|
e0454c66f042
Cache the converted docklet HICONs. Sean noticed that there are actually .ico files in pixmaps/tray/16 (something that I missed). I'm not sure if I should just use those and eliminate the stock pixmap to HICON conversion hackery or if we can just get rid of those and avoid the duplication.
Daniel Atallah <datallah@pidgin.im>
parents:
15765
diff
changeset
|
633 | } |
|
e0454c66f042
Cache the converted docklet HICONs. Sean noticed that there are actually .ico files in pixmaps/tray/16 (something that I missed). I'm not sure if I should just use those and eliminate the stock pixmap to HICON conversion hackery or if we can just get rid of those and avoid the duplication.
Daniel Atallah <datallah@pidgin.im>
parents:
15765
diff
changeset
|
634 | |
|
15765
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
635 | g_object_unref(image); |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15574
diff
changeset
|
636 | image = NULL; |
|
20142
af8e3a8b68df
applied changes from 0a36aea71847198e73c07cbef0be7e7a7db12c57
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
637 | |
|
af8e3a8b68df
applied changes from 0a36aea71847198e73c07cbef0be7e7a7db12c57
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
638 | gtk_widget_destroy(dummy_window); |
|
af8e3a8b68df
applied changes from 0a36aea71847198e73c07cbef0be7e7a7db12c57
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
639 | dummy_button = NULL; |
|
af8e3a8b68df
applied changes from 0a36aea71847198e73c07cbef0be7e7a7db12c57
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
640 | dummy_window = NULL; |
| 6209 | 641 | } |
| 642 | ||
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15562
diff
changeset
|
643 | static struct docklet_ui_ops winpidgin_tray_ops = |
| 6209 | 644 | { |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15562
diff
changeset
|
645 | winpidgin_tray_create, |
|
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15562
diff
changeset
|
646 | winpidgin_tray_destroy, |
|
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15562
diff
changeset
|
647 | winpidgin_tray_update_icon, |
|
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15562
diff
changeset
|
648 | winpidgin_tray_blank_icon, |
|
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15562
diff
changeset
|
649 | winpidgin_tray_set_tooltip, |
|
20962
bca687215ee8
disapproval of revision 'f69b1356bb5514053201a1c11ce435bd7b0d83a7'
Casey Harkins <charkins@pidgin.im>
parents:
20961
diff
changeset
|
650 | NULL |
| 6209 | 651 | }; |
| 652 | ||
| 653 | /* Used by docklet's plugin load func */ | |
| 654 | void docklet_ui_init() { | |
|
15770
e0454c66f042
Cache the converted docklet HICONs. Sean noticed that there are actually .ico files in pixmaps/tray/16 (something that I missed). I'm not sure if I should just use those and eliminate the stock pixmap to HICON conversion hackery or if we can just get rid of those and avoid the duplication.
Daniel Atallah <datallah@pidgin.im>
parents:
15765
diff
changeset
|
655 | /* Initialize the cached icons to NULL */ |
|
e0454c66f042
Cache the converted docklet HICONs. Sean noticed that there are actually .ico files in pixmaps/tray/16 (something that I missed). I'm not sure if I should just use those and eliminate the stock pixmap to HICON conversion hackery or if we can just get rid of those and avoid the duplication.
Daniel Atallah <datallah@pidgin.im>
parents:
15765
diff
changeset
|
656 | ZeroMemory(cached_icons, sizeof(cached_icons)); |
|
e0454c66f042
Cache the converted docklet HICONs. Sean noticed that there are actually .ico files in pixmaps/tray/16 (something that I missed). I'm not sure if I should just use those and eliminate the stock pixmap to HICON conversion hackery or if we can just get rid of those and avoid the duplication.
Daniel Atallah <datallah@pidgin.im>
parents:
15765
diff
changeset
|
657 | |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15562
diff
changeset
|
658 | pidgin_docklet_set_ui_ops(&winpidgin_tray_ops); |
| 6209 | 659 | } |