Mercurial > audlegacy
annotate src/audacious/ui_skinned_window.c @ 4544:084dbc8d23da
removed variable "has_x11_connection" from main.c, needed to hookify some functions therefore
author | mf0102 <0102@gmx.at> |
---|---|
date | Mon, 12 May 2008 23:01:06 +0200 |
parents | 6353bd9e4f05 |
children | d4c5719d30d1 |
rev | line source |
---|---|
2494
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
1 /* |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
2 * Audacious: A cross-platform multimedia player |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
3 * Copyright (c) 2007 William Pitcock <nenolod -at- sacredspiral.co.uk> |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
4 * |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
5 * This program is free software; you can redistribute it and/or modify |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
6 * it under the terms of the GNU General Public License as published by |
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
3068
diff
changeset
|
7 * the Free Software Foundation; under version 3 of the License. |
2494
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
8 * |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
9 * This program is distributed in the hope that it will be useful, |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
12 * GNU General Public License for more details. |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
13 * |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
14 * You should have received a copy of the GNU General Public License |
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
3068
diff
changeset
|
15 * along with this program. If not, see <http://www.gnu.org/licenses>. |
3123
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
16 * |
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
17 * The Audacious team does not consider modular code linking to |
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
18 * Audacious or using our public API to be a derived work. |
2494
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
19 */ |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
20 |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
21 #include "platform/smartinclude.h" |
4508
246244ead30e
renamed skin.* to ui_skin.* and moved ui_skinned_widget_draw() to it
mf0102 <0102@gmx.at>
parents:
4413
diff
changeset
|
22 #include "ui_skin.h" |
2494
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
23 |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
24 #include <gtk/gtkmain.h> |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
25 #include <glib-object.h> |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
26 #include <glib/gmacros.h> |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
27 #include <gtk/gtkmarshal.h> |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
28 #include <gtk/gtkwindow.h> |
3221
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
29 #include <string.h> |
2494
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
30 |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
31 #include "main.h" |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
32 #include "dock.h" |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
33 #include "ui_skinned_window.h" |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
34 #include "ui_skinned_cursor.h" |
3221
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
35 #include "ui_playlist.h" |
2494
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
36 |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
37 static void ui_skinned_window_class_init(SkinnedWindowClass *klass); |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
38 static void ui_skinned_window_init(GtkWidget *widget); |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
39 static GtkWindowClass *parent = NULL; |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
40 |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
41 GType |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
42 ui_skinned_window_get_type(void) |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
43 { |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
44 static GType window_type = 0; |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
45 |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
46 if (!window_type) |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
47 { |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
48 static const GTypeInfo window_info = |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
49 { |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
50 sizeof (SkinnedWindowClass), |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
51 NULL, /* base_init */ |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
52 NULL, /* base_finalize */ |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
53 (GClassInitFunc) ui_skinned_window_class_init, |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
54 NULL, /* class_finalize */ |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
55 NULL, /* class_data */ |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
56 sizeof (SkinnedWindow), |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
57 0, /* n_preallocs */ |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
58 (GInstanceInitFunc) ui_skinned_window_init |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
59 }; |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
60 |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
61 window_type = |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
62 g_type_register_static (GTK_TYPE_WINDOW, "SkinnedWindow", |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
63 &window_info, 0); |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
64 } |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
65 |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
66 return window_type; |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
67 } |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
68 |
4130
c2039c3004d6
set windows masks in saner way
Tomasz Mon <desowin@gmail.com>
parents:
4120
diff
changeset
|
69 static void |
c2039c3004d6
set windows masks in saner way
Tomasz Mon <desowin@gmail.com>
parents:
4120
diff
changeset
|
70 ui_skinned_window_map(GtkWidget *widget) |
c2039c3004d6
set windows masks in saner way
Tomasz Mon <desowin@gmail.com>
parents:
4120
diff
changeset
|
71 { |
c2039c3004d6
set windows masks in saner way
Tomasz Mon <desowin@gmail.com>
parents:
4120
diff
changeset
|
72 (* GTK_WIDGET_CLASS (parent)->map) (widget); |
c2039c3004d6
set windows masks in saner way
Tomasz Mon <desowin@gmail.com>
parents:
4120
diff
changeset
|
73 |
c2039c3004d6
set windows masks in saner way
Tomasz Mon <desowin@gmail.com>
parents:
4120
diff
changeset
|
74 SkinnedWindow *window = SKINNED_WINDOW(widget); |
c2039c3004d6
set windows masks in saner way
Tomasz Mon <desowin@gmail.com>
parents:
4120
diff
changeset
|
75 if (window->type == WINDOW_MAIN) |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4218
diff
changeset
|
76 gtk_widget_shape_combine_mask(widget, skin_get_mask(aud_active_skin, SKIN_MASK_MAIN + cfg.player_shaded), 0, 0); |
4130
c2039c3004d6
set windows masks in saner way
Tomasz Mon <desowin@gmail.com>
parents:
4120
diff
changeset
|
77 else if (window->type == WINDOW_EQ) |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4218
diff
changeset
|
78 gtk_widget_shape_combine_mask(widget, skin_get_mask(aud_active_skin, SKIN_MASK_EQ + cfg.equalizer_shaded), 0, 0); |
4521
6353bd9e4f05
save windows positions in docked_list_move(); remove ui_skinned_window_configure()
Tomasz Mon <desowin@gmail.com>
parents:
4520
diff
changeset
|
79 |
6353bd9e4f05
save windows positions in docked_list_move(); remove ui_skinned_window_configure()
Tomasz Mon <desowin@gmail.com>
parents:
4520
diff
changeset
|
80 gtk_window_set_keep_above(GTK_WINDOW(widget), cfg.always_on_top); |
4130
c2039c3004d6
set windows masks in saner way
Tomasz Mon <desowin@gmail.com>
parents:
4120
diff
changeset
|
81 } |
c2039c3004d6
set windows masks in saner way
Tomasz Mon <desowin@gmail.com>
parents:
4120
diff
changeset
|
82 |
2494
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
83 static gboolean |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
84 ui_skinned_window_motion_notify_event(GtkWidget *widget, |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
85 GdkEventMotion *event) |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
86 { |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
87 if (dock_is_moving(GTK_WINDOW(widget))) |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
88 dock_move_motion(GTK_WINDOW(widget), event); |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
89 |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
90 return FALSE; |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
91 } |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
92 |
3249
eff2e785e3b4
add focus_in and focus_out events
Tomasz Mon <desowin@gmail.com>
parents:
3223
diff
changeset
|
93 static gboolean ui_skinned_window_focus_in(GtkWidget *widget, GdkEventFocus *focus) { |
eff2e785e3b4
add focus_in and focus_out events
Tomasz Mon <desowin@gmail.com>
parents:
3223
diff
changeset
|
94 gboolean val = GTK_WIDGET_CLASS (parent)->focus_in_event (widget, focus); |
eff2e785e3b4
add focus_in and focus_out events
Tomasz Mon <desowin@gmail.com>
parents:
3223
diff
changeset
|
95 gtk_widget_queue_draw(widget); |
eff2e785e3b4
add focus_in and focus_out events
Tomasz Mon <desowin@gmail.com>
parents:
3223
diff
changeset
|
96 return val; |
eff2e785e3b4
add focus_in and focus_out events
Tomasz Mon <desowin@gmail.com>
parents:
3223
diff
changeset
|
97 } |
eff2e785e3b4
add focus_in and focus_out events
Tomasz Mon <desowin@gmail.com>
parents:
3223
diff
changeset
|
98 |
eff2e785e3b4
add focus_in and focus_out events
Tomasz Mon <desowin@gmail.com>
parents:
3223
diff
changeset
|
99 static gboolean ui_skinned_window_focus_out(GtkWidget *widget, GdkEventFocus *focus) { |
eff2e785e3b4
add focus_in and focus_out events
Tomasz Mon <desowin@gmail.com>
parents:
3223
diff
changeset
|
100 gboolean val = GTK_WIDGET_CLASS (parent)->focus_out_event (widget, focus); |
eff2e785e3b4
add focus_in and focus_out events
Tomasz Mon <desowin@gmail.com>
parents:
3223
diff
changeset
|
101 gtk_widget_queue_draw(widget); |
eff2e785e3b4
add focus_in and focus_out events
Tomasz Mon <desowin@gmail.com>
parents:
3223
diff
changeset
|
102 return val; |
eff2e785e3b4
add focus_in and focus_out events
Tomasz Mon <desowin@gmail.com>
parents:
3223
diff
changeset
|
103 } |
eff2e785e3b4
add focus_in and focus_out events
Tomasz Mon <desowin@gmail.com>
parents:
3223
diff
changeset
|
104 |
3221
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
105 static gboolean ui_skinned_window_expose(GtkWidget *widget, GdkEventExpose *event) { |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
106 SkinnedWindow *window = SKINNED_WINDOW(widget); |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
107 |
4195
2281da647da9
beggining of GdkPixbuf transition
Tomasz Mon <desowin@gmail.com>
parents:
4130
diff
changeset
|
108 GdkPixbuf *obj = NULL; |
3221
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
109 |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
110 gint width = 0, height = 0; |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
111 switch (window->type) { |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
112 case WINDOW_MAIN: |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4218
diff
changeset
|
113 width = aud_active_skin->properties.mainwin_width; |
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4218
diff
changeset
|
114 height = aud_active_skin->properties.mainwin_height; |
3221
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
115 break; |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
116 case WINDOW_EQ: |
4218
f1074a07ec09
mostly works, but the VIS is broken, and the eq window is too large...more bugs
Cristi Magherusan <majeru@atheme.org>
parents:
4216
diff
changeset
|
117 width = 275 * (cfg.scaled ? cfg.scale_factor : 1); |
f1074a07ec09
mostly works, but the VIS is broken, and the eq window is too large...more bugs
Cristi Magherusan <majeru@atheme.org>
parents:
4216
diff
changeset
|
118 height = 116 * (cfg.scaled ? cfg.scale_factor : 1) ; |
3221
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
119 break; |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
120 case WINDOW_PLAYLIST: |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
121 width = playlistwin_get_width(); |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
122 height = cfg.playlist_height; |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
123 break; |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
124 default: |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
125 return FALSE; |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
126 } |
4195
2281da647da9
beggining of GdkPixbuf transition
Tomasz Mon <desowin@gmail.com>
parents:
4130
diff
changeset
|
127 obj = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, width, height); |
3221
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
128 |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
129 gboolean focus = gtk_window_has_toplevel_focus(GTK_WINDOW(widget)); |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
130 |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
131 switch (window->type) { |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
132 case WINDOW_MAIN: |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4218
diff
changeset
|
133 skin_draw_pixbuf(widget, aud_active_skin, obj,SKIN_MAIN, 0, 0, 0, 0, width, height); |
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4218
diff
changeset
|
134 skin_draw_mainwin_titlebar(aud_active_skin, obj, cfg.player_shaded, focus || !cfg.dim_titlebar); |
3221
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
135 break; |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
136 case WINDOW_EQ: |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4218
diff
changeset
|
137 skin_draw_pixbuf(widget, aud_active_skin, obj, SKIN_EQMAIN, 0, 0, 0, 0, width, height); |
3221
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
138 if (focus || !cfg.dim_titlebar) { |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
139 if (!cfg.equalizer_shaded) |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4218
diff
changeset
|
140 skin_draw_pixbuf(widget, aud_active_skin, obj, SKIN_EQMAIN, 0, 134, 0, 0, width, 14); |
3221
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
141 else |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4218
diff
changeset
|
142 skin_draw_pixbuf(widget, aud_active_skin, obj, SKIN_EQ_EX, 0, 0, 0, 0, width, 14); |
3221
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
143 } else { |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
144 if (!cfg.equalizer_shaded) |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4218
diff
changeset
|
145 skin_draw_pixbuf(widget, aud_active_skin, obj, SKIN_EQMAIN, 0, 149, 0, 0, width, 14); |
3221
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
146 else |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4218
diff
changeset
|
147 skin_draw_pixbuf(widget, aud_active_skin, obj, SKIN_EQ_EX, 0, 15, 0, 0, width, 14); |
3221
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
148 } |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
149 break; |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
150 case WINDOW_PLAYLIST: |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
151 focus |= !cfg.dim_titlebar; |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
152 if (cfg.playlist_shaded) { |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4218
diff
changeset
|
153 skin_draw_playlistwin_shaded(aud_active_skin, obj, playlistwin_get_width(), focus); |
3221
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
154 } else { |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4218
diff
changeset
|
155 skin_draw_playlistwin_frame(aud_active_skin, obj, playlistwin_get_width(), cfg.playlist_height, focus); |
3221
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
156 } |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
157 break; |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
158 } |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
159 |
4212
47352b34dbdf
introduce ui_skinned_widget_draw
Tomasz Mon <desowin@gmail.com>
parents:
4195
diff
changeset
|
160 ui_skinned_widget_draw(GTK_WIDGET(window), obj, width, height, |
4216
75d99359357b
doublesize -> custom scale:
Cristi Magherusan <majeru@atheme.org>
parents:
4212
diff
changeset
|
161 window->type != WINDOW_PLAYLIST && cfg.scaled); |
4195
2281da647da9
beggining of GdkPixbuf transition
Tomasz Mon <desowin@gmail.com>
parents:
4130
diff
changeset
|
162 |
3221
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
163 g_object_unref(obj); |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
164 |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
165 return FALSE; |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
166 } |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
167 |
2494
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
168 static void |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
169 ui_skinned_window_class_init(SkinnedWindowClass *klass) |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
170 { |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
171 GtkWidgetClass *widget_class; |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
172 |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
173 widget_class = (GtkWidgetClass*) klass; |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
174 |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
175 parent = gtk_type_class(gtk_window_get_type()); |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
176 |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
177 widget_class->motion_notify_event = ui_skinned_window_motion_notify_event; |
3221
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
178 widget_class->expose_event = ui_skinned_window_expose; |
3249
eff2e785e3b4
add focus_in and focus_out events
Tomasz Mon <desowin@gmail.com>
parents:
3223
diff
changeset
|
179 widget_class->focus_in_event = ui_skinned_window_focus_in; |
eff2e785e3b4
add focus_in and focus_out events
Tomasz Mon <desowin@gmail.com>
parents:
3223
diff
changeset
|
180 widget_class->focus_out_event = ui_skinned_window_focus_out; |
4130
c2039c3004d6
set windows masks in saner way
Tomasz Mon <desowin@gmail.com>
parents:
4120
diff
changeset
|
181 widget_class->map = ui_skinned_window_map; |
2494
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
182 } |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
183 |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
184 void |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
185 ui_skinned_window_hide(SkinnedWindow *window) |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
186 { |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
187 g_return_if_fail(SKINNED_CHECK_WINDOW(window)); |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
188 |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
189 gtk_window_get_position(GTK_WINDOW(window), &window->x, &window->y); |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
190 gtk_widget_hide(GTK_WIDGET(window)); |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
191 } |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
192 |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
193 void |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
194 ui_skinned_window_show(SkinnedWindow *window) |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
195 { |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
196 g_return_if_fail(SKINNED_CHECK_WINDOW(window)); |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
197 |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
198 gtk_window_move(GTK_WINDOW(window), window->x, window->y); |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
199 gtk_widget_show_all(GTK_WIDGET(window)); |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
200 } |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
201 |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
202 static void |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
203 ui_skinned_window_init(GtkWidget *widget) |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
204 { |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
205 SkinnedWindow *window; |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
206 window = SKINNED_WINDOW(widget); |
2651
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2530
diff
changeset
|
207 window->x = -1; |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2530
diff
changeset
|
208 window->y = -1; |
2494
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
209 } |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
210 |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
211 GtkWidget * |
3068
c5189bc4100b
Refactor skinned window code.
William Pitcock <nenolod@atheme-project.org>
parents:
3067
diff
changeset
|
212 ui_skinned_window_new(const gchar *wmclass_name) |
2494
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
213 { |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
214 GtkWidget *widget = g_object_new(ui_skinned_window_get_type(), NULL); |
3063
0ac3c3bc5d4a
Set GTK+ window types.
William Pitcock <nenolod@atheme-project.org>
parents:
2840
diff
changeset
|
215 GtkWindow *window = GTK_WINDOW(widget); |
0ac3c3bc5d4a
Set GTK+ window types.
William Pitcock <nenolod@atheme-project.org>
parents:
2840
diff
changeset
|
216 |
3068
c5189bc4100b
Refactor skinned window code.
William Pitcock <nenolod@atheme-project.org>
parents:
3067
diff
changeset
|
217 window->type = SKINNED_WINDOW_TYPE; |
2494
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
218 |
2515
319b10203d7c
[svn] gtk_window_set_wmclass() has to be called before gtk_widget_realize(). Patched by Christian "Joker" Birchinger from Gentoo.
chainsaw
parents:
2496
diff
changeset
|
219 if (wmclass_name) |
319b10203d7c
[svn] gtk_window_set_wmclass() has to be called before gtk_widget_realize(). Patched by Christian "Joker" Birchinger from Gentoo.
chainsaw
parents:
2496
diff
changeset
|
220 gtk_window_set_wmclass(GTK_WINDOW(widget), wmclass_name, "Audacious"); |
319b10203d7c
[svn] gtk_window_set_wmclass() has to be called before gtk_widget_realize(). Patched by Christian "Joker" Birchinger from Gentoo.
chainsaw
parents:
2496
diff
changeset
|
221 |
2494
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
222 gtk_widget_add_events(GTK_WIDGET(widget), |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
223 GDK_FOCUS_CHANGE_MASK | GDK_BUTTON_MOTION_MASK | |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
224 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
225 GDK_SCROLL_MASK | GDK_KEY_PRESS_MASK | |
3221
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
226 GDK_VISIBILITY_NOTIFY_MASK | GDK_EXPOSURE_MASK); |
2494
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
227 gtk_widget_realize(GTK_WIDGET(widget)); |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
228 |
4517 | 229 set_dock_window_list(dock_window_set_decorated(get_dock_window_list(), |
230 GTK_WINDOW(widget), | |
231 cfg.show_wm_decorations)); | |
2494
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
232 gtk_widget_set_app_paintable(GTK_WIDGET(widget), TRUE); |
4120
51641a875a01
revise setting mask on windows
Tomasz Mon <desowin@gmail.com>
parents:
3933
diff
changeset
|
233 gdk_window_set_back_pixmap(widget->window, NULL, FALSE); |
51641a875a01
revise setting mask on windows
Tomasz Mon <desowin@gmail.com>
parents:
3933
diff
changeset
|
234 gtk_widget_shape_combine_mask(widget, NULL, 0, 0); |
2494
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
235 |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
236 ui_skinned_cursor_set(GTK_WIDGET(widget)); |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
237 |
3221
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
238 if (!strcmp(wmclass_name, "player")) |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
239 SKINNED_WINDOW(widget)->type = WINDOW_MAIN; |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
240 if (!strcmp(wmclass_name, "equalizer")) |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
241 SKINNED_WINDOW(widget)->type = WINDOW_EQ; |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
242 if (!strcmp(wmclass_name, "playlist")) |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
243 SKINNED_WINDOW(widget)->type = WINDOW_PLAYLIST; |
2525 | 244 |
2821 | 245 /* GtkFixed hasn't got its GdkWindow, this means that it can be used to |
246 display widgets while the logo below will be displayed anyway; | |
247 however fixed positions are not that great, cause the button sizes may (will) | |
248 vary depending on the gtk style used, so it's not possible to center | |
249 them unless a fixed width and heigth is forced (and this may bring to cutted | |
250 text if someone, i.e., uses a big font for gtk widgets); | |
251 other types of container most likely have their GdkWindow, this simply | |
252 means that the logo must be drawn on the container widget, instead of the | |
253 window; otherwise, it won't be displayed correctly */ | |
254 SKINNED_WINDOW(widget)->fixed = gtk_fixed_new(); | |
2840 | 255 gtk_container_add(GTK_CONTAINER(widget), GTK_WIDGET(SKINNED_WINDOW(widget)->fixed)); |
2494
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
256 return widget; |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff
changeset
|
257 } |
3221
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
258 |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
259 void ui_skinned_window_draw_all(GtkWidget *widget) { |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
260 if (SKINNED_WINDOW(widget)->type == WINDOW_MAIN) |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
261 mainwin_refresh_hints(); |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
262 |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
263 gtk_widget_queue_draw(widget); |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
264 GList *iter; |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
265 for (iter = GTK_FIXED (SKINNED_WINDOW(widget)->fixed)->children; iter; iter = g_list_next (iter)) { |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
266 GtkFixedChild *child_data = (GtkFixedChild *) iter->data; |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
267 GtkWidget *child = child_data->widget; |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
268 gtk_widget_queue_draw(child); |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
269 } |
9583cd62231f
implement ui_skinned_window_expose
Tomasz Mon <desowin@gmail.com>
parents:
3218
diff
changeset
|
270 } |