Mercurial > pidgin
annotate plugins/win32/transparency/win2ktrans.c @ 9840:e8caffe42e38
[gaim-migrate @ 10717]
See le ChangeLog.win32
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 23 Aug 2004 21:59:27 +0000 |
parents | d9a1674a9475 |
children | 0ddc84d81eac |
rev | line source |
---|---|
3729 | 1 /* |
6435
53a613fed06d
[gaim-migrate @ 6943]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6408
diff
changeset
|
2 * gaim - Transparency plugin |
3729 | 3 * |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
4 * copyright (c) 1998-2002, rob flynn <rob@marko.net> |
6435
53a613fed06d
[gaim-migrate @ 6943]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6408
diff
changeset
|
5 * copyright (c) 2002-2003, Herman Bloggs <hermanator12002@yahoo.com> |
3729 | 6 * |
7 * this program is free software; you can redistribute it and/or modify | |
8 * it under the terms of the gnu general public license as published by | |
9 * the free software foundation; either version 2 of the license, or | |
10 * (at your option) any later version. | |
11 * | |
12 * this program is distributed in the hope that it will be useful, | |
13 * but without any warranty; without even the implied warranty of | |
14 * merchantability or fitness for a particular purpose. see the | |
15 * gnu general public license for more details. | |
16 * | |
17 * you should have received a copy of the gnu general public license | |
18 * along with this program; if not, write to the free software | |
19 * foundation, inc., 59 temple place, suite 330, boston, ma 02111-1307 usa | |
20 * | |
21 */ | |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
22 #include <gdk/gdkwin32.h> |
5912
b3c412884a22
[gaim-migrate @ 6344]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
23 #include "internal.h" |
b3c412884a22
[gaim-migrate @ 6344]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
24 |
6494
4f93f10ddc75
[gaim-migrate @ 7009]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6435
diff
changeset
|
25 #include "core.h" |
5912
b3c412884a22
[gaim-migrate @ 6344]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
26 #include "prefs.h" |
b3c412884a22
[gaim-migrate @ 6344]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
27 #include "debug.h" |
b3c412884a22
[gaim-migrate @ 6344]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
28 |
b3c412884a22
[gaim-migrate @ 6344]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
29 #include "gtkconv.h" |
5224
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
30 #include "gtkplugin.h" |
5248 | 31 #include "gtkblist.h" |
5912
b3c412884a22
[gaim-migrate @ 6344]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
32 #include "gtkutils.h" |
6494
4f93f10ddc75
[gaim-migrate @ 7009]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6435
diff
changeset
|
33 #include "signals.h" |
3729 | 34 |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
35 /* |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
36 * MACROS & DEFINES |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
37 */ |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5749
diff
changeset
|
38 #define WINTRANS_PLUGIN_ID "gtk-win-trans" |
5224
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
39 #define WINTRANS_VERSION 1 |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
40 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
41 /* These defines aren't found in mingw's winuser.h */ |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
42 #ifndef LWA_ALPHA |
5224
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
43 #define LWA_ALPHA 0x00000002 |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
44 #endif |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
45 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
46 #ifndef WS_EX_LAYERED |
5224
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
47 #define WS_EX_LAYERED 0x00080000 |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
48 #endif |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
49 |
4726
0b1c01fd68f1
[gaim-migrate @ 5039]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4606
diff
changeset
|
50 #define blist (gaim_get_blist()?(GAIM_GTK_BLIST(gaim_get_blist())?((GAIM_GTK_BLIST(gaim_get_blist()))->window):NULL):NULL) |
0b1c01fd68f1
[gaim-migrate @ 5039]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4606
diff
changeset
|
51 |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
52 /* |
4569
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
53 * DATA STRUCTS |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
54 */ |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
55 typedef struct { |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
56 GtkWidget *win; |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
57 GtkWidget *slider; |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
58 } slider_win; |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
59 |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
60 |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
61 /* |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
62 * GLOBALS |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
63 */ |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
64 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
65 /* |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
66 * LOCALS |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
67 */ |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5749
diff
changeset
|
68 static const char *OPT_WINTRANS_IM_ENABLED="/plugins/gtk/win32/wintrans/im_enabled"; |
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5749
diff
changeset
|
69 static const char *OPT_WINTRANS_IM_ALPHA ="/plugins/gtk/win32/wintrans/im_alpha"; |
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5749
diff
changeset
|
70 static const char *OPT_WINTRANS_IM_SLIDER ="/plugins/gtk/win32/wintrans/im_slider"; |
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5749
diff
changeset
|
71 static const char *OPT_WINTRANS_BL_ENABLED="/plugins/gtk/win32/wintrans/bl_enabled"; |
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5749
diff
changeset
|
72 static const char *OPT_WINTRANS_BL_ALPHA ="/plugins/gtk/win32/wintrans/bl_alpha"; |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
73 static int imalpha = 255; |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
74 static int blalpha = 255; |
9840 | 75 static GList *window_list = NULL; |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
76 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
77 /* |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
78 * PROTOS |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
79 */ |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
80 BOOL (*MySetLayeredWindowAttributes)(HWND hwnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags)=NULL; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
81 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
82 /* |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
83 * CODE |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
84 */ |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5749
diff
changeset
|
85 static GtkWidget *wgaim_button(const char *text, const char *pref, GtkWidget *page) { |
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5749
diff
changeset
|
86 GtkWidget *button; |
5749
6d6ae91c5de7
[gaim-migrate @ 6174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5248
diff
changeset
|
87 button = gtk_check_button_new_with_mnemonic(text); |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5749
diff
changeset
|
88 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), gaim_prefs_get_bool(pref)); |
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5749
diff
changeset
|
89 gtk_box_pack_start(GTK_BOX(page), button, FALSE, FALSE, 0); |
5749
6d6ae91c5de7
[gaim-migrate @ 6174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5248
diff
changeset
|
90 gtk_widget_show(button); |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5749
diff
changeset
|
91 return button; |
5749
6d6ae91c5de7
[gaim-migrate @ 6174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5248
diff
changeset
|
92 } |
6d6ae91c5de7
[gaim-migrate @ 6174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5248
diff
changeset
|
93 |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
94 /* Set window transparency level */ |
9840 | 95 static void set_wintrans(GtkWidget *window, int trans) { |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
96 if(MySetLayeredWindowAttributes) { |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
97 HWND hWnd = GDK_WINDOW_HWND(window->window); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
98 SetWindowLong(hWnd,GWL_EXSTYLE,GetWindowLong(hWnd,GWL_EXSTYLE) | WS_EX_LAYERED); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
99 MySetLayeredWindowAttributes(hWnd,0,trans,LWA_ALPHA); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
100 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
101 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
102 |
9840 | 103 static void set_wintrans_off(GtkWidget *window) { |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
104 if(MySetLayeredWindowAttributes) { |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
105 HWND hWnd = GDK_WINDOW_HWND(window->window); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
106 SetWindowLong(hWnd, GWL_EXSTYLE, GetWindowLong(hWnd, GWL_EXSTYLE) & ~WS_EX_LAYERED); |
8961 | 107 |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
108 /* Ask the window and its children to repaint */ |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
109 RedrawWindow(hWnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
110 } |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
111 } |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
112 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
113 static void change_alpha(GtkWidget *w, gpointer data) { |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
114 set_wintrans(GTK_WIDGET(data), gtk_range_get_value(GTK_RANGE(w))); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
115 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
116 |
9840 | 117 static int has_transparency() { |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
118 return MySetLayeredWindowAttributes ? TRUE : FALSE; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
119 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
120 |
9840 | 121 static GtkWidget *wintrans_slider(GtkWidget *win) { |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
122 GtkWidget *hbox; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
123 GtkWidget *label, *slider; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
124 GtkWidget *frame; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
125 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
126 frame = gtk_frame_new(NULL); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
127 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_OUT); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
128 gtk_widget_show(frame); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
129 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
130 hbox = gtk_hbox_new(FALSE, 5); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
131 gtk_container_add(GTK_CONTAINER(frame), hbox); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
132 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
133 label = gtk_label_new(_("Opacity:")); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
134 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
135 gtk_widget_show(hbox); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
136 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
137 slider = gtk_hscale_new_with_range(50,255,1); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
138 gtk_range_set_value(GTK_RANGE(slider), imalpha); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
139 gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
140 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
141 /* On slider val change, update window's transparency level */ |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
142 gtk_signal_connect(GTK_OBJECT(slider), "value-changed", GTK_SIGNAL_FUNC(change_alpha), win); |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
143 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
144 gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
145 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
146 /* Set the initial transparency level */ |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
147 set_wintrans(win, imalpha); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
148 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
149 gtk_widget_show_all(hbox); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
150 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
151 return frame; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
152 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
153 |
4569
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
154 static slider_win* find_slidwin( GtkWidget *win ) { |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
155 GList *tmp = window_list; |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
156 |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
157 while(tmp) { |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
158 if( ((slider_win*)(tmp->data))->win == win) |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
159 return (slider_win*)tmp->data; |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
160 tmp = tmp->next; |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
161 } |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
162 return NULL; |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
163 } |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
164 |
9840 | 165 static gboolean win_destroy_cb(GtkWidget *widget, GdkEvent *event, gpointer user_data) { |
4569
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
166 slider_win *slidwin=NULL; |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
167 /* Remove window from the window list */ |
8961 | 168 gaim_debug_info(WINTRANS_PLUGIN_ID, "Conv window destoyed.. removing from list\n"); |
4569
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
169 |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
170 if((slidwin=find_slidwin(widget))) { |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
171 window_list = g_list_remove(window_list, (gpointer)slidwin); |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
172 g_free(slidwin); |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
173 } |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
174 return FALSE; |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
175 } |
3729 | 176 |
8961 | 177 static void set_trans_option(GtkWidget *w, const char *pref) { |
178 gaim_prefs_set_bool(pref, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))); | |
179 if(pref == OPT_WINTRANS_BL_ENABLED) { | |
180 if(blist) { | |
181 if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) | |
182 set_wintrans(blist, blalpha); | |
183 else | |
184 set_wintrans_off(blist); | |
185 } | |
186 } | |
187 } | |
188 | |
189 static void add_slider(GtkWidget *win) { | |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
190 GList *wl, *wl1; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
191 GtkWidget *vbox=NULL; |
8961 | 192 |
193 /* Look up this window to see if it already has a slider */ | |
194 if(!find_slidwin(win)) { | |
195 GtkWidget *slider_box=NULL; | |
196 slider_win *slidwin=NULL; | |
197 | |
198 /* Get top vbox */ | |
199 for ( wl1 = wl = gtk_container_get_children(GTK_CONTAINER(win)); | |
200 wl != NULL; | |
201 wl = wl->next ) { | |
202 if ( GTK_IS_VBOX(GTK_OBJECT(wl->data)) ) | |
203 vbox = GTK_WIDGET(wl->data); | |
204 else { | |
205 gaim_debug_error(WINTRANS_PLUGIN_ID, "no vbox found\n"); | |
206 return; | |
207 } | |
208 } | |
209 g_list_free(wl1); | |
210 | |
211 slider_box = wintrans_slider(win); | |
212 gtk_box_pack_start(GTK_BOX(vbox), | |
213 slider_box, | |
214 FALSE, FALSE, 0); | |
215 /* Add window to list, to track that it has a slider */ | |
216 slidwin = g_new0( slider_win, 1 ); | |
217 slidwin->win = win; | |
218 slidwin->slider = slider_box; | |
219 window_list = g_list_append(window_list, (gpointer)slidwin); | |
220 /* Set callback to remove window from the list, if the window is destroyed */ | |
221 g_signal_connect(GTK_OBJECT(win), "destroy_event", G_CALLBACK(win_destroy_cb), NULL); | |
222 } | |
223 } | |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
224 |
8961 | 225 static void remove_sliders() { |
226 if(window_list) { | |
227 GList *tmp=window_list; | |
228 while(tmp) { | |
229 slider_win *slidwin = (slider_win*)tmp->data; | |
9840 | 230 if (slidwin != NULL && GTK_IS_WINDOW(slidwin->win)) |
231 gtk_widget_destroy(slidwin->slider); | |
8961 | 232 g_free(slidwin); |
233 tmp=tmp->next; | |
234 } | |
235 g_list_free(window_list); | |
236 window_list = NULL; | |
237 } | |
238 } | |
239 | |
240 static void remove_convs_wintrans() { | |
241 GList *conv; | |
242 | |
243 for(conv = gaim_get_conversations(); conv != NULL; conv = conv->next) | |
244 set_wintrans_off(GAIM_GTK_WINDOW(gaim_conversation_get_window(conv->data))->window); | |
245 } | |
5749
6d6ae91c5de7
[gaim-migrate @ 6174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5248
diff
changeset
|
246 |
8961 | 247 static void update_convs_wintrans(GtkWidget *w, const char *pref) { |
248 GList *conv; | |
249 | |
250 if (w != NULL) | |
251 set_trans_option(w, pref); | |
252 | |
253 if(gaim_prefs_get_bool(OPT_WINTRANS_IM_ENABLED)) { | |
254 for(conv = gaim_get_conversations(); conv != NULL; conv = conv->next) | |
255 set_wintrans(GAIM_GTK_WINDOW(gaim_conversation_get_window(conv->data))->window, gaim_prefs_get_int(OPT_WINTRANS_IM_ALPHA)); | |
256 } | |
257 else | |
258 remove_convs_wintrans(); | |
259 | |
260 if(gaim_prefs_get_bool(OPT_WINTRANS_IM_SLIDER) | |
261 && gaim_prefs_get_bool(OPT_WINTRANS_IM_ENABLED)) { | |
262 for(conv = gaim_get_conversations(); conv != NULL; conv = conv->next) | |
263 add_slider(GAIM_GTK_WINDOW(gaim_conversation_get_window(conv->data))->window); | |
264 } | |
265 else | |
266 remove_sliders(); | |
267 } | |
268 | |
269 static void set_window_trans(GaimConvWindow *oldwin, GaimConvWindow *newwin) { | |
270 GtkWidget *win = GAIM_GTK_WINDOW(newwin)->window; | |
3729 | 271 |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
272 /* check prefs to see if we want trans */ |
6435
53a613fed06d
[gaim-migrate @ 6943]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6408
diff
changeset
|
273 if (gaim_prefs_get_bool(OPT_WINTRANS_IM_ENABLED) && gaim_prefs_get_bool(OPT_WINTRANS_IM_SLIDER)) { |
8961 | 274 add_slider(win); |
275 } | |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
276 |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5749
diff
changeset
|
277 if(gaim_prefs_get_bool(OPT_WINTRANS_IM_ENABLED) && |
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5749
diff
changeset
|
278 !gaim_prefs_get_bool(OPT_WINTRANS_IM_SLIDER)) { |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
279 set_wintrans(win, imalpha); |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
280 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
281 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
282 |
8961 | 283 static void gaim_new_conversation(GaimConversation *c) { |
284 GaimConvWindow *win = gaim_conversation_get_window(c); | |
285 set_window_trans(NULL, win); | |
286 } | |
287 | |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
288 static void blist_created() { |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
289 if(blist) { |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5749
diff
changeset
|
290 if(gaim_prefs_get_bool(OPT_WINTRANS_BL_ENABLED)) |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
291 set_wintrans(blist, blalpha); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
292 else |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
293 set_wintrans_off(blist); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
294 } |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
295 } |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
296 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
297 static void alpha_change(GtkWidget *w, gpointer data) { |
8961 | 298 GList *conv; |
9840 | 299 imalpha = gtk_range_get_value(GTK_RANGE(w)); |
8961 | 300 |
301 for(conv = gaim_get_conversations(); conv != NULL; conv = conv->next) | |
9840 | 302 set_wintrans(GAIM_GTK_WINDOW(gaim_conversation_get_window(conv->data))->window, imalpha); |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
303 } |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
304 |
9840 | 305 static void alpha_pref_set_int(GtkWidget *w, GdkEventFocus *e, const char *pref) |
306 { | |
307 if (pref == OPT_WINTRANS_IM_ALPHA) | |
308 gaim_prefs_set_int(pref, imalpha); | |
309 else if (pref == OPT_WINTRANS_BL_ALPHA) | |
310 gaim_prefs_set_int(pref, blalpha); | |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5749
diff
changeset
|
311 } |
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5749
diff
changeset
|
312 |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
313 static void bl_alpha_change(GtkWidget *w, gpointer data) { |
9840 | 314 blalpha = gtk_range_get_value(GTK_RANGE(w)); |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
315 if(blist) |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
316 change_alpha(w, blist); |
3729 | 317 } |
318 | |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
319 /* |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
320 * EXPORTED FUNCTIONS |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
321 */ |
9840 | 322 gboolean plugin_load(GaimPlugin *plugin) { |
323 imalpha = gaim_prefs_get_int(OPT_WINTRANS_IM_ALPHA); | |
324 blalpha = gaim_prefs_get_int(OPT_WINTRANS_BL_ALPHA); | |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5749
diff
changeset
|
325 |
9840 | 326 gaim_signal_connect((void*)gaim_conversations_get_handle(), |
327 "conversation-created", | |
328 plugin, | |
329 GAIM_CALLBACK(gaim_new_conversation), | |
330 NULL); | |
6494
4f93f10ddc75
[gaim-migrate @ 7009]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6435
diff
changeset
|
331 gaim_signal_connect((void*)gaim_connections_get_handle(), "signed-on", plugin, GAIM_CALLBACK(blist_created), NULL); |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
332 MySetLayeredWindowAttributes = (void*)wgaim_find_and_loadproc("user32.dll", "SetLayeredWindowAttributes" ); |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5749
diff
changeset
|
333 |
8961 | 334 gaim_signal_connect((void*)gaim_gtk_conversations_get_handle(), "conversation-drag-ended", plugin, GAIM_CALLBACK(set_window_trans), NULL); |
335 | |
336 update_convs_wintrans(NULL, NULL); | |
337 | |
9840 | 338 if(blist) |
339 blist_created(); | |
3729 | 340 |
5224
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
341 return TRUE; |
3729 | 342 } |
343 | |
9840 | 344 gboolean plugin_unload(GaimPlugin *plugin) { |
8961 | 345 gaim_debug_info(WINTRANS_PLUGIN_ID, "Removing win2ktrans.dll plugin\n"); |
4569
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
346 |
8961 | 347 remove_convs_wintrans(); |
9840 | 348 remove_sliders(); |
8961 | 349 |
9840 | 350 if(blist) |
4492
d629e7989a8a
[gaim-migrate @ 4767]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4400
diff
changeset
|
351 set_wintrans_off(blist); |
9840 | 352 |
5224
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
353 return TRUE; |
3729 | 354 } |
355 | |
9840 | 356 GtkWidget *get_config_frame(GaimPlugin *plugin) { |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
357 GtkWidget *ret; |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
358 GtkWidget *imtransbox, *bltransbox; |
3729 | 359 GtkWidget *hbox; |
360 GtkWidget *label, *slider; | |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
361 GtkWidget *button; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
362 GtkWidget *trans_box; |
3729 | 363 |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
364 ret = gtk_vbox_new(FALSE, 18); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
365 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
366 |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
367 /* IM Convo trans options */ |
5749
6d6ae91c5de7
[gaim-migrate @ 6174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5248
diff
changeset
|
368 imtransbox = gaim_gtk_make_frame (ret, _("IM Conversation Windows")); |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5749
diff
changeset
|
369 button = wgaim_button(_("_IM window transparency"), OPT_WINTRANS_IM_ENABLED, imtransbox); |
8961 | 370 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(update_convs_wintrans), (void *)OPT_WINTRANS_IM_ENABLED); |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
371 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
372 trans_box = gtk_vbox_new(FALSE, 18); |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5749
diff
changeset
|
373 if (!gaim_prefs_get_bool(OPT_WINTRANS_IM_ENABLED)) |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
374 gtk_widget_set_sensitive(GTK_WIDGET(trans_box), FALSE); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
375 gtk_widget_show(trans_box); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
376 |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
377 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gaim_gtk_toggle_sensitive), trans_box); |
9840 | 378 |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5749
diff
changeset
|
379 button = wgaim_button(_("_Show slider bar in IM window"), OPT_WINTRANS_IM_SLIDER, trans_box); |
8961 | 380 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(update_convs_wintrans), (void *)OPT_WINTRANS_IM_SLIDER); |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
381 |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
382 gtk_box_pack_start(GTK_BOX(imtransbox), trans_box, FALSE, FALSE, 5); |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
383 |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
384 /* IM transparency slider */ |
3729 | 385 hbox = gtk_hbox_new(FALSE, 5); |
386 | |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
387 label = gtk_label_new(_("Opacity:")); |
3729 | 388 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); |
389 | |
390 slider = gtk_hscale_new_with_range(50,255,1); | |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
391 gtk_range_set_value(GTK_RANGE(slider), imalpha); |
3729 | 392 gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1); |
9840 | 393 |
394 gtk_signal_connect(GTK_OBJECT(slider), "value-changed", GTK_SIGNAL_FUNC(alpha_change), NULL); | |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5749
diff
changeset
|
395 gtk_signal_connect(GTK_OBJECT(slider), "focus-out-event", GTK_SIGNAL_FUNC(alpha_pref_set_int), (void *)OPT_WINTRANS_IM_ALPHA); |
3729 | 396 |
397 gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5); | |
398 | |
399 gtk_widget_show_all(hbox); | |
400 | |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
401 gtk_box_pack_start(GTK_BOX(trans_box), hbox, FALSE, FALSE, 5); |
9840 | 402 |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
403 /* Buddy List trans options */ |
5749
6d6ae91c5de7
[gaim-migrate @ 6174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5248
diff
changeset
|
404 bltransbox = gaim_gtk_make_frame (ret, _("Buddy List Window")); |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5749
diff
changeset
|
405 button = wgaim_button(_("_Buddy List window transparency"), OPT_WINTRANS_BL_ENABLED, bltransbox); |
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5749
diff
changeset
|
406 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_trans_option), (void *)OPT_WINTRANS_BL_ENABLED); |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
407 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
408 trans_box = gtk_vbox_new(FALSE, 18); |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5749
diff
changeset
|
409 if (!gaim_prefs_get_bool(OPT_WINTRANS_BL_ENABLED)) |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
410 gtk_widget_set_sensitive(GTK_WIDGET(trans_box), FALSE); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
411 gtk_widget_show(trans_box); |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
412 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gaim_gtk_toggle_sensitive), trans_box); |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
413 gtk_box_pack_start(GTK_BOX(bltransbox), trans_box, FALSE, FALSE, 5); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
414 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
415 /* IM transparency slider */ |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
416 hbox = gtk_hbox_new(FALSE, 5); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
417 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
418 label = gtk_label_new(_("Opacity:")); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
419 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
420 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
421 slider = gtk_hscale_new_with_range(50,255,1); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
422 gtk_range_set_value(GTK_RANGE(slider), blalpha); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
423 gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1); |
9840 | 424 |
425 gtk_signal_connect(GTK_OBJECT(slider), "value-changed", GTK_SIGNAL_FUNC(bl_alpha_change), NULL); | |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5749
diff
changeset
|
426 gtk_signal_connect(GTK_OBJECT(slider), "focus-out-event", GTK_SIGNAL_FUNC(alpha_pref_set_int), (void *)OPT_WINTRANS_BL_ALPHA); |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
427 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
428 gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
429 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
430 gtk_widget_show_all(hbox); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
431 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
432 gtk_box_pack_start(GTK_BOX(trans_box), hbox, FALSE, FALSE, 5); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
433 |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
434 /* If this version of Windows dosn't support Transparency, grey out options */ |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
435 if(!has_transparency()) { |
8961 | 436 gaim_debug_warning(WINTRANS_PLUGIN_ID, "This version of windows dosn't support transparency\n"); |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
437 gtk_widget_set_sensitive(GTK_WIDGET(imtransbox), FALSE); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
438 gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
439 gtk_widget_set_sensitive(GTK_WIDGET(trans_box), FALSE); |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
440 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
441 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
442 gtk_widget_show_all(ret); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
443 return ret; |
3729 | 444 } |
5224
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
445 |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
446 static GaimGtkPluginUiInfo ui_info = |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
447 { |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
448 get_config_frame |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
449 }; |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
450 |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
451 static GaimPluginInfo info = |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
452 { |
8749
d7b8eb1f0a18
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
6494
diff
changeset
|
453 GAIM_PLUGIN_API_VERSION, /**< api_version */ |
5224
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
454 GAIM_PLUGIN_STANDARD, /**< type */ |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
455 GAIM_GTK_PLUGIN_TYPE, /**< ui_requirement */ |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
456 0, /**< flags */ |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
457 NULL, /**< dependencies */ |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
458 GAIM_PRIORITY_DEFAULT, /**< priority */ |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
459 |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
460 WINTRANS_PLUGIN_ID, /**< id */ |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
461 N_("Transparency"), /**< name */ |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
462 VERSION, /**< version */ |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
463 /** summary */ |
8779
4b0b96196cfb
[gaim-migrate @ 9541]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
8749
diff
changeset
|
464 N_("Variable Transparency for the buddy list and conversations."), |
5224
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
465 /** description */ |
8779
4b0b96196cfb
[gaim-migrate @ 9541]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
8749
diff
changeset
|
466 N_("This plugin enables variable alpha transparency on conversation windows and the buddy list.\n\n" |
4b0b96196cfb
[gaim-migrate @ 9541]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
8749
diff
changeset
|
467 "* Note: This plugin requires Win2000 or WinXP."), |
5224
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
468 "Herman Bloggs <hermanator12002@yahoo.com>", /**< author */ |
6408
90fc2199c156
[gaim-migrate @ 6914]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6063
diff
changeset
|
469 GAIM_WEBSITE, /**< homepage */ |
5224
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
470 |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
471 plugin_load, /**< load */ |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
472 plugin_unload, /**< unload */ |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
473 NULL, /**< destroy */ |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
474 |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
475 &ui_info, /**< ui_info */ |
8993 | 476 NULL, /**< extra_info */ |
477 NULL, | |
478 NULL | |
5224
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
479 }; |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
480 |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
481 static void |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5749
diff
changeset
|
482 init_plugin(GaimPlugin *plugin) |
5224
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
483 { |
9840 | 484 gaim_prefs_add_none("/plugins/gtk/win32"); |
485 gaim_prefs_add_none("/plugins/gtk/win32/wintrans"); | |
486 gaim_prefs_add_bool("/plugins/gtk/win32/wintrans/im_enabled", FALSE); | |
487 gaim_prefs_add_int("/plugins/gtk/win32/wintrans/im_alpha", 255); | |
488 gaim_prefs_add_bool("/plugins/gtk/win32/wintrans/im_slider", FALSE); | |
489 gaim_prefs_add_bool("/plugins/gtk/win32/wintrans/bl_enabled", FALSE); | |
490 gaim_prefs_add_int("/plugins/gtk/win32/wintrans/bl_alpha", 255); | |
5224
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
491 } |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
492 |
6063 | 493 GAIM_INIT_PLUGIN(wintrans, init_plugin, info) |