summarylogtreecommitdiffstats
path: root/gtk2.patch
blob: 1f31f9c79e5f265f3b1a93d90fc78416f8c23c83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
diff -up src/volumeicon-0.5.1/configure.ac.orig src/volumeicon-0.5.1/configure.ac
--- src/volumeicon-0.5.1/configure.ac.orig	2015-03-02 15:42:13.000000000 -0700
+++ src/volumeicon-0.5.1/configure.ac	2015-07-19 21:06:08.000000000 -0600
@@ -35,7 +35,7 @@ AC_ARG_ENABLE([notify],
   [notify=no])
 
 # Check for gtk
-PKG_CHECK_MODULES([GTK], [gtk+-3.0 >= 3.0])
+PKG_CHECK_MODULES([GTK], [gtk+-2.0 >= 2.16])
 AC_SUBST(GTK_CFLAGS)
 AC_SUBST(GTK_LIBS)
 
@@ -64,8 +64,8 @@ AC_ARG_WITH([oss-include-path],
       OSS_CPPFLAGS="-I${OSSLIBDIR}/include/sys"
       OSS_HEADER="${OSSLIBDIR}/include/sys/soundcard.h"
     else
-      OSS_CPPFLAGS="-I/usr/lib/oss/include/sys"
-      OSS_HEADER="/usr/lib/oss/include/sys/soundcard.h"
+      OSS_CPPFLAGS=""
+      OSS_HEADER="sys/soundcard.h"
     fi
   ]
 )
@@ -75,7 +75,7 @@ AC_ARG_WITH([oss-include-path],
 # to fail.
 OLD_CPPFLAGS=${CPPFLAGS}
 CPPFLAGS="${OSS_CPPFLAGS}"
-AC_CHECK_HEADER([soundcard.h], [], [AC_MSG_ERROR([could not find soundcard.h])], [])
+AC_CHECK_HEADER([sys/soundcard.h], [], [AC_MSG_ERROR([could not find soundcard.h])], [])
 CPPFLAGS=${OLD_CPPFLAGS}
 
 # Pass the absolute path to the OSS header file
diff -up src/volumeicon-0.5.1/data/gui/preferences.ui.orig src/volumeicon-0.5.1/data/gui/preferences.ui
--- src/volumeicon-0.5.1/data/gui/preferences.ui.orig	2015-03-02 12:18:58.000000000 -0700
+++ src/volumeicon-0.5.1/data/gui/preferences.ui	2015-07-19 21:06:08.000000000 -0600
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!-- Generated with glade 3.18.3 -->
 <interface>
-  <requires lib="gtk+" version="3.0"/>
+  <requires lib="gtk+" version="2.24"/>
   <object class="GtkListStore" id="channel_name_model">
     <columns>
       <!-- column-name channel_name_column -->
@@ -46,12 +46,10 @@
     <property name="step_increment">1</property>
   </object>
   <object class="GtkWindow" id="window">
-    <property name="width_request">406</property>
     <property name="can_focus">False</property>
     <property name="title" translatable="yes">Preferences</property>
     <property name="resizable">False</property>
     <property name="window_position">center</property>
-    <property name="has_resize_grip">False</property>
     <child>
       <object class="GtkAlignment" id="alignment1">
         <property name="visible">True</property>
@@ -61,10 +59,9 @@
         <property name="left_padding">10</property>
         <property name="right_padding">10</property>
         <child>
-          <object class="GtkBox" id="box1">
+          <object class="GtkVBox" id="box1">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="orientation">vertical</property>
             <child>
               <object class="GtkNotebook" id="notebook1">
                 <property name="visible">True</property>
@@ -79,10 +76,9 @@
                     <property name="left_padding">10</property>
                     <property name="right_padding">10</property>
                     <child>
-                      <object class="GtkBox" id="box2">
+                      <object class="GtkVBox" id="box2">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="orientation">vertical</property>
                         <property name="spacing">5</property>
                         <child>
                           <object class="GtkFrame" id="frame2">
@@ -231,10 +227,9 @@
                     <property name="left_padding">10</property>
                     <property name="right_padding">10</property>
                     <child>
-                      <object class="GtkBox" id="box6">
+                      <object class="GtkVBox" id="box6">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="orientation">vertical</property>
                         <child>
                           <object class="GtkFrame" id="frame3">
                             <property name="visible">True</property>
@@ -248,10 +243,9 @@
                                 <property name="left_padding">12</property>
                                 <property name="right_padding">10</property>
                                 <child>
-                                  <object class="GtkBox" id="box7">
+                                  <object class="GtkVBox" id="box7">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
-                                    <property name="orientation">vertical</property>
                                     <property name="spacing">3</property>
                                     <child>
                                       <object class="GtkTable" id="table1">
@@ -736,10 +730,9 @@
                     <property name="left_padding">10</property>
                     <property name="right_padding">10</property>
                     <child>
-                      <object class="GtkBox" id="box4">
+                      <object class="GtkVBox" id="box4">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="orientation">vertical</property>
                         <child>
                           <object class="GtkFrame" id="frame9">
                             <property name="visible">True</property>
@@ -753,7 +746,7 @@
                                 <property name="left_padding">12</property>
                                 <property name="right_padding">10</property>
                                 <child>
-                                  <object class="GtkBox" id="box5">
+                                  <object class="GtkHBox" id="box5">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
                                     <property name="spacing">10</property>
@@ -776,7 +769,6 @@
                                       <object class="GtkComboBox" id="notification_combobox">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
-                                        <property name="hexpand">True</property>
                                         <property name="model">notification_type_model</property>
                                         <child>
                                           <object class="GtkCellRendererText" id="cellrenderertext5"/>
@@ -841,10 +833,9 @@
                 <property name="can_focus">False</property>
                 <property name="top_padding">10</property>
                 <child>
-                  <object class="GtkBox" id="box3">
+                  <object class="GtkVBox" id="box3">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="orientation">vertical</property>
                     <child>
                       <object class="GtkButton" id="close_button">
                         <property name="label">gtk-close</property>
@@ -852,7 +843,6 @@
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">True</property>
-                        <property name="halign">end</property>
                         <property name="use_stock">True</property>
                       </object>
                       <packing>
diff -up src/volumeicon-0.5.1/src/bind.c.orig src/volumeicon-0.5.1/src/bind.c
--- src/volumeicon-0.5.1/src/bind.c.orig	2015-03-02 13:03:01.000000000 -0700
+++ src/volumeicon-0.5.1/src/bind.c	2015-07-19 21:06:08.000000000 -0600
@@ -151,7 +151,11 @@ grab_ungrab_with_ignorable_modifiers (Gd
 			XGrabKey (GDK_WINDOW_XDISPLAY (rootwin),
 			          keycode,
 			          modifiers | mod_masks [i],
+#if GTK_CHECK_VERSION(3,0,0)
 			          gdk_x11_window_get_xid (rootwin),
+#elif GTK_CHECK_VERSION(2,16,0)
+				  GDK_WINDOW_XID (rootwin),
+#endif
 			          False,
 			          GrabModeAsync,
 			          GrabModeAsync);
@@ -159,7 +163,12 @@ grab_ungrab_with_ignorable_modifiers (Gd
 			XUngrabKey (GDK_WINDOW_XDISPLAY (rootwin),
 			            keycode,
 			            modifiers | mod_masks [i],
-			            gdk_x11_window_get_xid (rootwin));
+#if GTK_CHECK_VERSION(3,0,0)
+			            gdk_x11_window_get_xid (rootwin)
+#elif GTK_CHECK_VERSION(2,16,0)
+			            GDK_WINDOW_XID (rootwin)
+#endif
+				   );
 		}
 	}
 	gdk_flush();
diff -up src/volumeicon-0.5.1/src/volumeicon.c.orig src/volumeicon-0.5.1/src/volumeicon.c
--- src/volumeicon-0.5.1/src/volumeicon.c.orig	2015-03-02 15:27:44.000000000 -0700
+++ src/volumeicon-0.5.1/src/volumeicon.c	2015-07-19 21:11:19.000000000 -0600
@@ -710,6 +710,7 @@ static gboolean scale_timeout(gpointer d
 	gtk_window_get_size(GTK_WINDOW(m_scale_window), &window.width, &window.height);
 	gtk_status_icon_get_geometry(m_status_icon, NULL, &icon, NULL);
 
+#if GTK_CHECK_VERSION(3,0,0)
 	GdkWindow *root_window;
 	GdkDeviceManager *device_manager;
 	GdkDevice *pointer;
@@ -719,6 +720,15 @@ static gboolean scale_timeout(gpointer d
 	device_manager = gdk_display_get_device_manager(gdk_window_get_display(root_window));
 	pointer = gdk_device_manager_get_client_pointer(device_manager);
 	gdk_window_get_device_position(root_window, pointer, &x, &y, NULL);
+#elif GTK_CHECK_VERSION(2,16,0)
+	GdkWindow *root_window;
+	gint x, y;
+
+	root_window = gtk_widget_get_root_window(m_scale_window);
+	gdk_display_get_pointer(gdk_window_get_display(root_window), NULL, &x, &y, NULL);
+#else
+#error No GTK version
+#endif
 
 	if(scale_point_in_rect(&window, x, y) || scale_point_in_rect(&icon, x, y))
 	{
@@ -1070,6 +1080,7 @@ static void render_widget (cairo_t *cair
 	cairo_paint (cairo_context);
 }
 
+#if GTK_CHECK_VERSION(3,0,0)
 static void update_widget (GtkWidget *widget, gint width, gint height)
 {
 	cairo_surface_t *mask;
@@ -1100,6 +1111,32 @@ static void update_widget (GtkWidget *wi
 		cairo_surface_destroy(mask);
 	}
 }
+#elif GTK_CHECK_VERSION(2,0,0)
+static void update_widget (GtkWidget *widget, gint width, gint height)
+{
+	GdkPixmap *bitmap;
+	
+	bitmap = gdk_pixmap_new(NULL, width, height, 1);
+	if (bitmap != NULL) {
+		cairo_t *cairo_context = gdk_cairo_create(GDK_DRAWABLE(bitmap));
+
+		if (cairo_status(cairo_context) == CAIRO_STATUS_SUCCESS) {
+
+			render_widget(cairo_context, width, height);
+			cairo_destroy(cairo_context);
+
+			gtk_widget_input_shape_combine_mask(widget, NULL, 0, 0);
+			if (!gtk_widget_is_composited(widget))
+				gtk_widget_input_shape_combine_mask(widget, bitmap, 0, 0);
+
+			gtk_widget_shape_combine_mask(widget, NULL, 0, 0);
+			if (!gtk_widget_is_composited(widget))
+				gtk_widget_shape_combine_mask(widget, bitmap, 0, 0);
+		}
+		g_object_unref(G_OBJECT(bitmap));
+	}
+}
+#endif
 
 static gboolean on_configure (GtkWidget *widget, GdkEventConfigure *event, gpointer user_data)
 {
@@ -1114,9 +1151,17 @@ static gboolean on_configure (GtkWidget
 
 static gboolean on_draw (GtkWidget *widget, cairo_t *cairo_context, gpointer user_data)
 {
+#if GTK_CHECK_VERSION(3,0,0)
 	render_widget(cairo_context,
 		gtk_widget_get_allocated_width(widget),
 		gtk_widget_get_allocated_height(widget));
+#elif GTK_CHECK_VERSION(2,16,0)
+	GtkAllocation allocation;
+	gtk_widget_get_allocation(widget,&allocation);
+	render_widget(cairo_context,
+		allocation.width,
+		allocation.height);
+#endif
 	return FALSE;
 }
 
@@ -1131,11 +1176,21 @@ static void scale_setup()
 {
 	GdkScreen *screen;
 
+#if GTK_CHECK_VERSION(3,0,0)
 	if(config_get_use_horizontal_slider())
 		m_scale = gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL, 0.0, 100.0, 1.0);
-	else
+	else {
 		m_scale = gtk_scale_new_with_range(GTK_ORIENTATION_VERTICAL, 0.0, 100.0, 1.0);
-	gtk_range_set_inverted(GTK_RANGE(m_scale), TRUE);
+		gtk_range_set_inverted(GTK_RANGE(m_scale), TRUE);
+	}
+#elif GTK_CHECK_VERSION(2,16,0)
+	if (config_get_use_horizontal_slider())
+		m_scale = gtk_hscale_new_with_range(0.0, 100.0, 1.0);
+	else {
+		m_scale = gtk_vscale_new_with_range(0.0, 100.0, 1.0);
+		gtk_range_set_inverted(GTK_RANGE(m_scale), TRUE);
+	}
+#endif
 	gtk_scale_set_draw_value(GTK_SCALE(m_scale), config_get_show_sound_level());
 
 	m_scale_window = gtk_window_new(GTK_WINDOW_POPUP);
@@ -1147,15 +1202,27 @@ static void scale_setup()
 			gtk_widget_set_visual(GTK_WIDGET(m_scale_window), visual);
 			gtk_widget_set_app_paintable(GTK_WIDGET(m_scale_window), TRUE);
 			gtk_widget_realize(GTK_WIDGET(m_scale_window));
+#if GTK_CHECK_VERSION(3,0,0)
 			gdk_window_set_background_pattern(gtk_widget_get_window(GTK_WIDGET(m_scale_window)), NULL);
+#elif GTK_CHECK_VERSION(2,16,0)
+			gdk_window_set_back_pixmap(gtk_widget_get_window(GTK_WIDGET(m_scale_window)), NULL, FALSE);
+#endif
 			gtk_window_set_type_hint(GTK_WINDOW(m_scale_window), GDK_WINDOW_TYPE_HINT_DOCK);
 
 			g_signal_connect(G_OBJECT(m_scale_window), "draw", G_CALLBACK(on_draw), NULL);
 			g_signal_connect(G_OBJECT(m_scale_window), "configure-event", G_CALLBACK(on_configure), NULL);
 
+#if GTK_CHECK_VERSION(3,0,0)
 			update_widget(GTK_WIDGET(m_scale_window),
 				gtk_widget_get_allocated_width(GTK_WIDGET(m_scale_window)),
 				gtk_widget_get_allocated_height(GTK_WIDGET(m_scale_window)));
+#elif GTK_CHECK_VERSION(2,16,0)
+			GtkAllocation allocation;
+			gtk_widget_get_allocation(GTK_WIDGET(m_scale_window), &allocation);
+			update_widget(GTK_WIDGET(m_scale_window),
+				allocation.width,
+				allocation.height);
+#endif
 		}
 	}
 
@@ -1271,13 +1338,26 @@ int main(int argc, char * argv[])
     /* Initialize the progress bar. */
     m_pbar = (GtkProgressBar *)gtk_progress_bar_new();
     gtk_progress_bar_set_fraction(m_pbar, 0.0);
+#if GTK_CHECK_VERSION(3,0,0)
     gtk_orientable_set_orientation(GTK_ORIENTABLE(m_pbar),
                                    GTK_ORIENTATION_HORIZONTAL);
     gtk_progress_bar_set_show_text(m_pbar, TRUE);
+#elif GTK_CHECK_VERSION(2,16,0)
+    gtk_progress_bar_set_orientation(m_pbar,
+				     GTK_PROGRESS_LEFT_TO_RIGHT);
+#else
+#error No GTK version
+#endif
     gtk_widget_show(GTK_WIDGET(m_pbar));
 
     /* Add icon image and progress bar to hbox. */
+#if GTK_CHECK_VERSION(3,0,0)
     GtkBox *hbox = (GtkBox *)gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 3);
+#elif GTK_CHECK_VERSION(2,16,0)
+    GtkHBox *hbox = (GtkHBox *)gtk_hbox_new(FALSE, 3);
+#else
+#error No GTK version
+#endif
     gtk_box_pack_start(
         GTK_BOX(hbox), GTK_WIDGET(m_popup_icon), FALSE, FALSE, 0);
     gtk_box_pack_start(