comparison plugins/win32/transparency/win2ktrans.c @ 6435:53a613fed06d

[gaim-migrate @ 6943] Fix for bug #772771. Thanks Phroggie. Moved Blist On Top option to winprefs plugin committer: Tailor Script <tailor@pidgin.im>
author Herman Bloggs <hermanator12002@yahoo.com>
date Tue, 12 Aug 2003 01:26:23 +0000
parents 90fc2199c156
children 4f93f10ddc75
comparison
equal deleted inserted replaced
6434:974e3e6d4cc8 6435:53a613fed06d
1 /* 1 /*
2 * win2ktrans 2 * gaim - Transparency plugin
3 * 3 *
4 * copyright (c) 1998-2002, rob flynn <rob@marko.net> 4 * copyright (c) 1998-2002, rob flynn <rob@marko.net>
5 * 5 * copyright (c) 2002-2003, Herman Bloggs <hermanator12002@yahoo.com>
6 * Contributions by Herman Bloggs <hermanator12002@yahoo.com>
7 * 6 *
8 * this program is free software; you can redistribute it and/or modify 7 * this program is free software; you can redistribute it and/or modify
9 * it under the terms of the gnu general public license as published by 8 * it under the terms of the gnu general public license as published by
10 * the free software foundation; either version 2 of the license, or 9 * the free software foundation; either version 2 of the license, or
11 * (at your option) any later version. 10 * (at your option) any later version.
67 static const char *OPT_WINTRANS_IM_ENABLED="/plugins/gtk/win32/wintrans/im_enabled"; 66 static const char *OPT_WINTRANS_IM_ENABLED="/plugins/gtk/win32/wintrans/im_enabled";
68 static const char *OPT_WINTRANS_IM_ALPHA ="/plugins/gtk/win32/wintrans/im_alpha"; 67 static const char *OPT_WINTRANS_IM_ALPHA ="/plugins/gtk/win32/wintrans/im_alpha";
69 static const char *OPT_WINTRANS_IM_SLIDER ="/plugins/gtk/win32/wintrans/im_slider"; 68 static const char *OPT_WINTRANS_IM_SLIDER ="/plugins/gtk/win32/wintrans/im_slider";
70 static const char *OPT_WINTRANS_BL_ENABLED="/plugins/gtk/win32/wintrans/bl_enabled"; 69 static const char *OPT_WINTRANS_BL_ENABLED="/plugins/gtk/win32/wintrans/bl_enabled";
71 static const char *OPT_WINTRANS_BL_ALPHA ="/plugins/gtk/win32/wintrans/bl_alpha"; 70 static const char *OPT_WINTRANS_BL_ALPHA ="/plugins/gtk/win32/wintrans/bl_alpha";
72 static const char *OPT_WINTRANS_BL_ON_TOP ="/plugins/gtk/win32/wintrans/bl_on_top";
73 static int imalpha = 255; 71 static int imalpha = 255;
74 static int blalpha = 255; 72 static int blalpha = 255;
75 GList *window_list = NULL; 73 GList *window_list = NULL;
76 74
77 /* 75 /*
187 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c)); 185 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c));
188 186
189 win = gtkwin->window; 187 win = gtkwin->window;
190 188
191 /* check prefs to see if we want trans */ 189 /* check prefs to see if we want trans */
192 if (gaim_prefs_get_bool(OPT_WINTRANS_IM_SLIDER)) { 190 if (gaim_prefs_get_bool(OPT_WINTRANS_IM_ENABLED) && gaim_prefs_get_bool(OPT_WINTRANS_IM_SLIDER)) {
193 /* Look up this window to see if it already has a scroller */ 191 /* Look up this window to see if it already has a slider */
194 if(!find_slidwin(win)) { 192 if(!find_slidwin(win)) {
195 GtkWidget *slider_box=NULL; 193 GtkWidget *slider_box=NULL;
196 slider_win *slidwin=NULL; 194 slider_win *slidwin=NULL;
197 195
198 /* Get top vbox */ 196 /* Get top vbox */
230 } 228 }
231 } 229 }
232 230
233 static void blist_created() { 231 static void blist_created() {
234 if(blist) { 232 if(blist) {
235 if(gaim_prefs_get_bool(OPT_WINTRANS_BL_ON_TOP))
236 SetWindowPos(GDK_WINDOW_HWND(blist->window), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
237 else
238 SetWindowPos(GDK_WINDOW_HWND(blist->window), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
239
240 if(gaim_prefs_get_bool(OPT_WINTRANS_BL_ENABLED)) 233 if(gaim_prefs_get_bool(OPT_WINTRANS_BL_ENABLED))
241 set_wintrans(blist, blalpha); 234 set_wintrans(blist, blalpha);
242 else 235 else
243 set_wintrans_off(blist); 236 set_wintrans_off(blist);
244 } 237 }
265 change_alpha(w, blist); 258 change_alpha(w, blist);
266 } 259 }
267 260
268 static void set_trans_option(GtkWidget *w, const char *pref) { 261 static void set_trans_option(GtkWidget *w, const char *pref) {
269 gaim_prefs_set_bool(pref, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))); 262 gaim_prefs_set_bool(pref, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)));
270 if(pref == OPT_WINTRANS_BL_ON_TOP) { 263 if(pref == OPT_WINTRANS_BL_ENABLED) {
271 if(blist) {
272 if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)))
273 SetWindowPos(GDK_WINDOW_HWND(blist->window), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
274 else
275 SetWindowPos(GDK_WINDOW_HWND(blist->window), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
276 }
277 } else if(pref == OPT_WINTRANS_BL_ENABLED) {
278 if(blist) { 264 if(blist) {
279 if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) 265 if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)))
280 set_wintrans(blist, blalpha); 266 set_wintrans(blist, blalpha);
281 else 267 else
282 set_wintrans_off(blist); 268 set_wintrans_off(blist);
317 } 303 }
318 g_list_free(window_list); 304 g_list_free(window_list);
319 window_list = NULL; 305 window_list = NULL;
320 } 306 }
321 if(blist) { 307 if(blist) {
322 SetWindowPos(GDK_WINDOW_HWND(blist->window), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
323 set_wintrans_off(blist); 308 set_wintrans_off(blist);
324 } 309 }
325 return TRUE; 310 return TRUE;
326 } 311 }
327 312
372 357
373 gtk_box_pack_start(GTK_BOX(trans_box), hbox, FALSE, FALSE, 5); 358 gtk_box_pack_start(GTK_BOX(trans_box), hbox, FALSE, FALSE, 5);
374 359
375 /* Buddy List trans options */ 360 /* Buddy List trans options */
376 bltransbox = gaim_gtk_make_frame (ret, _("Buddy List Window")); 361 bltransbox = gaim_gtk_make_frame (ret, _("Buddy List Window"));
377 button = wgaim_button(_("_Keep Buddy List window on top"), OPT_WINTRANS_BL_ON_TOP, bltransbox);
378 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_trans_option), (void *)OPT_WINTRANS_BL_ON_TOP);
379
380 button = wgaim_button(_("_Buddy List window transparency"), OPT_WINTRANS_BL_ENABLED, bltransbox); 362 button = wgaim_button(_("_Buddy List window transparency"), OPT_WINTRANS_BL_ENABLED, bltransbox);
381 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_trans_option), (void *)OPT_WINTRANS_BL_ENABLED); 363 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_trans_option), (void *)OPT_WINTRANS_BL_ENABLED);
382 364
383 trans_box = gtk_vbox_new(FALSE, 18); 365 trans_box = gtk_vbox_new(FALSE, 18);
384 if (!gaim_prefs_get_bool(OPT_WINTRANS_BL_ENABLED)) 366 if (!gaim_prefs_get_bool(OPT_WINTRANS_BL_ENABLED))
458 gaim_prefs_add_bool("/plugins/gtk/win32/wintrans/im_enabled", FALSE); 440 gaim_prefs_add_bool("/plugins/gtk/win32/wintrans/im_enabled", FALSE);
459 gaim_prefs_add_int("/plugins/gtk/win32/wintrans/im_alpha", 255); 441 gaim_prefs_add_int("/plugins/gtk/win32/wintrans/im_alpha", 255);
460 gaim_prefs_add_bool("/plugins/gtk/win32/wintrans/im_slider", FALSE); 442 gaim_prefs_add_bool("/plugins/gtk/win32/wintrans/im_slider", FALSE);
461 gaim_prefs_add_bool("/plugins/gtk/win32/wintrans/bl_enabled", FALSE); 443 gaim_prefs_add_bool("/plugins/gtk/win32/wintrans/bl_enabled", FALSE);
462 gaim_prefs_add_int("/plugins/gtk/win32/wintrans/bl_alpha", 255); 444 gaim_prefs_add_int("/plugins/gtk/win32/wintrans/bl_alpha", 255);
463 gaim_prefs_add_bool("/plugins/gtk/win32/wintrans/bl_on_top", FALSE);
464 } 445 }
465 446
466 GAIM_INIT_PLUGIN(wintrans, init_plugin, info) 447 GAIM_INIT_PLUGIN(wintrans, init_plugin, info)