comparison src/win32/win32dep.c @ 4026:a997156437b6

[gaim-migrate @ 4230] Win prefs page w/ transparency option added committer: Tailor Script <tailor@pidgin.im>
author Herman Bloggs <hermanator12002@yahoo.com>
date Sun, 01 Dec 2002 03:08:27 +0000
parents a1245dcf7b31
children a3ec0146c73e
comparison
equal deleted inserted replaced
4025:0d8b71d0d8f8 4026:a997156437b6
38 */ 38 */
39 static char install_dir[MAXPATHLEN]; 39 static char install_dir[MAXPATHLEN];
40 static char lib_dir[MAXPATHLEN]; 40 static char lib_dir[MAXPATHLEN];
41 static char locale_dir[MAXPATHLEN]; 41 static char locale_dir[MAXPATHLEN];
42 static int bhide_icon; 42 static int bhide_icon;
43 43 static int imalpha = 255;
44 44
45 /* 45 /*
46 * GLOBALS 46 * GLOBALS
47 */ 47 */
48 HINSTANCE gaimexe_hInstance = 0; 48 HINSTANCE gaimexe_hInstance = 0;
50 50
51 /* 51 /*
52 * PROTOS 52 * PROTOS
53 */ 53 */
54 BOOL (*MyFlashWindowEx)(PFLASHWINFO pfwi)=NULL; 54 BOOL (*MyFlashWindowEx)(PFLASHWINFO pfwi)=NULL;
55 55 BOOL (*MySetLayeredWindowAttributes)(HWND hwnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags)=NULL;
56 void wgaim_set_wintrans(GtkWidget *window, int trans);
56 57
57 /* 58 /*
58 * STATIC CODE 59 * STATIC CODE
59 */ 60 */
60 61
102 } 103 }
103 return NULL; 104 return NULL;
104 } 105 }
105 } 106 }
106 107
107 108 static void load_winver_specific_procs(void) {
108 void load_winver_specific_procs(void) {
109 /* Used for Win98+ and WinNT5+ */ 109 /* Used for Win98+ and WinNT5+ */
110 MyFlashWindowEx = (void*)find_and_loadproc("user32.dll", "FlashWindowEx" ); 110 MyFlashWindowEx = (void*)find_and_loadproc("user32.dll", "FlashWindowEx" );
111 } 111 /* Used for Win2k+ */
112 112 MySetLayeredWindowAttributes = (void*)find_and_loadproc("user32.dll", "SetLayeredWindowAttributes" );
113 }
114
115 /* Transparency slider callbacks */
116 static void change_im_alpha(GtkWidget *w, gpointer data) {
117 wgaim_set_wintrans(GTK_WIDGET(data), gtk_range_get_value(GTK_RANGE(w)));
118 }
113 119
114 /* 120 /*
115 * PUBLIC CODE 121 * PUBLIC CODE
116 */ 122 */
117 123
177 183
178 /* Start Flashing window */ 184 /* Start Flashing window */
179 finfo->t_handle = gtk_timeout_add(1000, flash_window_cb, GDK_WINDOW_HWND(window->window)); 185 finfo->t_handle = gtk_timeout_add(1000, flash_window_cb, GDK_WINDOW_HWND(window->window));
180 finfo->sig_handler = g_signal_connect(G_OBJECT(window), "focus-in-event", G_CALLBACK(halt_flash_filter), finfo); 186 finfo->sig_handler = g_signal_connect(G_OBJECT(window), "focus-in-event", G_CALLBACK(halt_flash_filter), finfo);
181 } 187 }
188 }
189
190 /* Set window transparency level */
191 void wgaim_set_wintrans(GtkWidget *window, int trans) {
192 if(MySetLayeredWindowAttributes) {
193 HWND hWnd = GDK_WINDOW_HWND(window->window);
194 SetWindowLong(hWnd,GWL_EXSTYLE,GetWindowLong(hWnd,GWL_EXSTYLE) | WS_EX_LAYERED);
195 MySetLayeredWindowAttributes(hWnd,0,trans,LWA_ALPHA);
196 }
197 }
198
199 void wgaim_set_imalpha(int val) {
200 imalpha = val;
201 }
202
203 int wgaim_get_imalpha(int val) {
204 return imalpha;
205 }
206
207 int wgaim_has_transparency() {
208 return MySetLayeredWindowAttributes ? TRUE : FALSE;
209 }
210
211 GtkWidget *wgaim_wintrans_slider(GtkWidget *win) {
212 GtkWidget *hbox;
213 GtkWidget *label, *slider;
214
215 hbox = gtk_hbox_new(FALSE, 5);
216
217 label = gtk_label_new(_("Opacity:"));
218 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
219
220 slider = gtk_hscale_new_with_range(50,255,1);
221 gtk_range_set_value(GTK_RANGE(slider), imalpha);
222 gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1);
223
224 /* On slider val change, update window's transparency level */
225 gtk_signal_connect(GTK_OBJECT(slider), "value-changed", GTK_SIGNAL_FUNC(change_im_alpha), win);
226 gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5);
227
228 /* Set the initial transparency level */
229 wgaim_set_wintrans(win, imalpha);
230
231 gtk_widget_show_all(hbox);
232
233 return hbox;
182 } 234 }
183 235
184 /* Windows Initializations */ 236 /* Windows Initializations */
185 237
186 void wgaim_init(void) { 238 void wgaim_init(void) {