annotate pidgin/win32/gtkdocklet-win32.c @ 29819:10bf97a36be0

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