annotate plugins/win32/transparency/win2ktrans.c @ 4021:0deae72976cb

[gaim-migrate @ 4221] removing libnativewin committer: Tailor Script <tailor@pidgin.im>
author Herman Bloggs <hermanator12002@yahoo.com>
date Fri, 29 Nov 2002 23:05:50 +0000
parents 0d1d4ba2c843
children 72d973958607
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1 /*
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2 * win2ktrans
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3 *
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4 * copyright (c) 1998-2002, rob flynn <rob@marko.net>
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
5 *
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
6 * this program is free software; you can redistribute it and/or modify
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
7 * it under the terms of the gnu general public license as published by
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
8 * the free software foundation; either version 2 of the license, or
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
9 * (at your option) any later version.
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
10 *
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
11 * this program is distributed in the hope that it will be useful,
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
12 * but without any warranty; without even the implied warranty of
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
13 * merchantability or fitness for a particular purpose. see the
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
14 * gnu general public license for more details.
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
15 *
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
16 * you should have received a copy of the gnu general public license
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
17 * along with this program; if not, write to the free software
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
18 * foundation, inc., 59 temple place, suite 330, boston, ma 02111-1307 usa
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
19 *
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
20 */
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
21 #define GAIM_PLUGINS
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
22
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
23 #include <gtk/gtk.h>
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
24 #include "wintransparency.h"
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
25 #include "gaim.h"
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
26
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
27 int alpha = 255;
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
28
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
29 static void gaim_new_conversation(char *who) {
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
30 struct conversation *c = find_conversation(who);
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
31
3740
e90f619845ae [gaim-migrate @ 3878]
Rob Flynn <gaim@robflynn.com>
parents: 3729
diff changeset
32 if (!c || alpha == 255)
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
33 return;
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
34
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
35 gdk_window_add_filter (GTK_WIDGET(c->window)->window, wgaim_window_filter, c);
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
36 }
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
37
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
38
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
39 G_MODULE_EXPORT char *gaim_plugin_init(GModule *handle) {
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
40
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
41
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
42 gaim_signal_connect(handle, event_new_conversation, gaim_new_conversation, NULL);
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
43
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
44 return NULL;
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
45 }
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
46
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
47 G_MODULE_EXPORT void gaim_plugin_remove() {
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
48 }
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
49
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
50 struct gaim_plugin_description desc;
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
51
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
52 G_MODULE_EXPORT struct gaim_plugin_description *gaim_plugin_desc() {
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
53 desc.api_version = PLUGIN_API_VERSION;
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
54 desc.name = g_strdup(_("Transparency"));
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
55 desc.version = g_strdup(VERSION);
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
56 desc.description = g_strdup(_("This plugin enables variable alpha transparency on conversation windows.\n\n* Note: This plugin requires Win2000 or WinXP."));
3831
0d1d4ba2c843 [gaim-migrate @ 3980]
Rob Flynn <gaim@robflynn.com>
parents: 3740
diff changeset
57 desc.authors = g_strdup(_("Rob Flynn &lt;rob@marko.net&gt;"));
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
58 desc.url = g_strdup(WEBSITE);
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
59 return &desc;
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
60 }
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
61
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
62 G_MODULE_EXPORT char *name() {
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
63 return _("Transparency");
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
64 }
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
65
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
66 G_MODULE_EXPORT char *description() {
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
67 return _("This plugin enables variable alpha transparency on conversation windows.\n\n* Note: This plugin requires Win2000 or WinXP.");
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
68 }
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
69
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
70 void alpha_value_changed(GtkWidget *w, gpointer data)
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
71 {
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
72 alpha = gtk_range_get_value(GTK_RANGE(w));
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
73 }
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
74
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
75 G_MODULE_EXPORT GtkWidget *gaim_plugin_config_gtk() {
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
76 GtkWidget *hbox;
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
77 GtkWidget *label, *slider;
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
78
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
79 hbox = gtk_hbox_new(FALSE, 5);
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
80
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
81 label = gtk_label_new(_("Opacity:"));
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
82 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
83
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
84 slider = gtk_hscale_new_with_range(50,255,1);
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
85 gtk_range_set_value(GTK_RANGE(slider), 255);
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
86 gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1);
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
87
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
88 gtk_signal_connect(GTK_OBJECT(slider), "value-changed", GTK_SIGNAL_FUNC(alpha_value_changed), NULL);
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
89
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
90 gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5);
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
91
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
92 gtk_widget_show_all(hbox);
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
93
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
94 return hbox;
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
95 }