summaryrefslogtreecommitdiff
path: root/plugins/xrandr/msd-xrandr-manager.c
diff options
context:
space:
mode:
authormonsta <[email protected]>2016-11-20 22:24:08 +0300
committermonsta <[email protected]>2016-11-20 22:24:08 +0300
commitde1227d4355f56017270f3a7541b8be21fd955af (patch)
tree37ad9b1c13c571ed51da2c5649e33cb9a2a9e7fe /plugins/xrandr/msd-xrandr-manager.c
parentc0e9048f916f4141292ca3b107735496e698cac5 (diff)
downloadmate-settings-daemon-de1227d4355f56017270f3a7541b8be21fd955af.tar.bz2
mate-settings-daemon-de1227d4355f56017270f3a7541b8be21fd955af.tar.xz
move to GTK+3 (>= 3.14), drop GTK+2 code and --with-gtk build option
and require libmatekbd and libmate-desktop >= 1.17
Diffstat (limited to 'plugins/xrandr/msd-xrandr-manager.c')
-rw-r--r--plugins/xrandr/msd-xrandr-manager.c51
1 files changed, 1 insertions, 50 deletions
diff --git a/plugins/xrandr/msd-xrandr-manager.c b/plugins/xrandr/msd-xrandr-manager.c
index 31d90e1..3fd9413 100644
--- a/plugins/xrandr/msd-xrandr-manager.c
+++ b/plugins/xrandr/msd-xrandr-manager.c
@@ -1679,21 +1679,12 @@ status_icon_popup_menu_selection_done_cb (GtkMenuShell *menu_shell, gpointer dat
* to see why that "after" handler is needed.
*/
static gboolean
-#if GTK_CHECK_VERSION (3, 0, 0)
output_title_label_draw_cb (GtkWidget *widget, cairo_t *cr, gpointer data)
-#else
-output_title_label_expose_event_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
-#endif
{
MsdXrandrManager *manager = MSD_XRANDR_MANAGER (data);
struct MsdXrandrManagerPrivate *priv = manager->priv;
MateRROutputInfo *output;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA color;
-#else
- GdkColor color;
- cairo_t *cr;
-#endif
GtkAllocation allocation;
g_assert (GTK_IS_LABEL (widget));
@@ -1704,12 +1695,7 @@ output_title_label_expose_event_cb (GtkWidget *widget, GdkEventExpose *event, gp
g_assert (priv->labeler != NULL);
/* Draw a black rectangular border, filled with the color that corresponds to this output */
-#if GTK_CHECK_VERSION (3, 0, 0)
mate_rr_labeler_get_rgba_for_output (priv->labeler, output, &color);
-#else
- mate_rr_labeler_get_color_for_output (priv->labeler, output, &color);
- cr = gdk_cairo_create (gtk_widget_get_window (widget));
-#endif
cairo_set_source_rgb (cr, 0, 0, 0);
cairo_set_line_width (cr, OUTPUT_TITLE_ITEM_BORDER);
@@ -1721,11 +1707,7 @@ output_title_label_expose_event_cb (GtkWidget *widget, GdkEventExpose *event, gp
allocation.height - OUTPUT_TITLE_ITEM_BORDER);
cairo_stroke (cr);
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_cairo_set_source_rgba (cr, &color);
-#else
- gdk_cairo_set_source_color (cr, &color);
-#endif
cairo_rectangle (cr,
allocation.x + OUTPUT_TITLE_ITEM_BORDER,
allocation.y + OUTPUT_TITLE_ITEM_BORDER,
@@ -1747,19 +1729,12 @@ output_title_label_expose_event_cb (GtkWidget *widget, GdkEventExpose *event, gp
gtk_widget_set_state (widget, GTK_STATE_NORMAL);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cairo_destroy (cr);
-#endif
return FALSE;
}
/* See the comment in output_title_event_box_expose_event_cb() about this funny label widget */
static gboolean
-#if GTK_CHECK_VERSION (3, 0, 0)
output_title_label_after_draw_cb (GtkWidget *widget, cairo_t *cr, gpointer data)
-#else
-output_title_label_after_expose_event_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
-#endif
{
g_assert (GTK_IS_LABEL (widget));
gtk_widget_set_state (widget, GTK_STATE_INSENSITIVE);
@@ -1847,17 +1822,10 @@ make_menu_item_for_output_title (MsdXrandrManager *manager, MateRROutputInfo *ou
* to its expose-event signal. See the comment in *** to see why need to connect
* to the label both 'before' and 'after'.
*/
-#if GTK_CHECK_VERSION (3, 0, 0)
g_signal_connect (label, "draw",
G_CALLBACK (output_title_label_draw_cb), manager);
g_signal_connect_after (label, "draw",
G_CALLBACK (output_title_label_after_draw_cb) , manager);
-#else
- g_signal_connect (label, "expose-event",
- G_CALLBACK (output_title_label_expose_event_cb), manager);
- g_signal_connect_after (label, "expose-event",
- G_CALLBACK (output_title_label_after_expose_event_cb), manager);
-#endif
g_object_set_data (G_OBJECT (label), "output", output);
@@ -2125,7 +2093,6 @@ status_icon_popup_menu (MsdXrandrManager *manager, guint button, guint32 timesta
g_signal_connect (priv->popup_menu, "selection-done",
G_CALLBACK (status_icon_popup_menu_selection_done_cb), manager);
-#if GTK_CHECK_VERSION (3, 0, 0)
/*Set up custom theming and forced transparency support*/
GtkWidget *toplevel = gtk_widget_get_toplevel (priv->popup_menu);
/*Fix any failures of compiz/other wm's to communicate with gtk for transparency */
@@ -2137,7 +2104,7 @@ status_icon_popup_menu (MsdXrandrManager *manager, guint button, guint32 timesta
context = gtk_widget_get_style_context (GTK_WIDGET(toplevel));
gtk_style_context_add_class(context,"gnome-panel-menu-bar");
gtk_style_context_add_class(context,"mate-panel-menu-bar");
-#endif
+
gtk_menu_popup (GTK_MENU (priv->popup_menu), NULL, NULL,
gtk_status_icon_position_menu,
priv->status_icon, button, timestamp);
@@ -2382,11 +2349,7 @@ msd_xrandr_manager_start (MsdXrandrManager *manager,
True, GrabModeAsync, GrabModeAsync);
gdk_flush ();
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_error_trap_pop_ignored ();
-#else
- gdk_error_trap_pop ();
-#endif
}
if (manager->priv->rotate_windows_keycode) {
@@ -2398,11 +2361,7 @@ msd_xrandr_manager_start (MsdXrandrManager *manager,
True, GrabModeAsync, GrabModeAsync);
gdk_flush ();
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_error_trap_pop_ignored ();
-#else
- gdk_error_trap_pop ();
-#endif
}
show_timestamps_dialog (manager, "Startup");
@@ -2441,11 +2400,7 @@ msd_xrandr_manager_stop (MsdXrandrManager *manager)
manager->priv->switch_video_mode_keycode, AnyModifier,
gdk_x11_get_default_root_xwindow());
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_error_trap_pop_ignored ();
-#else
- gdk_error_trap_pop ();
-#endif
}
if (manager->priv->rotate_windows_keycode) {
@@ -2455,11 +2410,7 @@ msd_xrandr_manager_stop (MsdXrandrManager *manager)
manager->priv->rotate_windows_keycode, AnyModifier,
gdk_x11_get_default_root_xwindow());
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_error_trap_pop_ignored ();
-#else
- gdk_error_trap_pop ();
-#endif
}
gdk_window_remove_filter (gdk_get_default_root_window (),