diff options
author | monsta <[email protected]> | 2018-01-28 22:19:00 +0300 |
---|---|---|
committer | raveit65 <[email protected]> | 2018-01-30 17:06:31 +0100 |
commit | 2165616a83855afbb1c9b69c736de2e7c7dfbdf8 (patch) | |
tree | 7ac83afa0d7b77e49e6bb7f8b02383693c207d22 /mate-screenshot | |
parent | 526b193ba678a7826af232526dfec0a37836a7e5 (diff) | |
download | mate-utils-2165616a83855afbb1c9b69c736de2e7c7dfbdf8.tar.bz2 mate-utils-2165616a83855afbb1c9b69c736de2e7c7dfbdf8.tar.xz |
require GTK+ 3.22 and GLib 2.50
Diffstat (limited to 'mate-screenshot')
-rw-r--r-- | mate-screenshot/src/mate-screenshot.c | 26 | ||||
-rw-r--r-- | mate-screenshot/src/screenshot-utils.c | 70 |
2 files changed, 1 insertions, 95 deletions
diff --git a/mate-screenshot/src/mate-screenshot.c b/mate-screenshot/src/mate-screenshot.c index 0b5c3332..e4251fed 100644 --- a/mate-screenshot/src/mate-screenshot.c +++ b/mate-screenshot/src/mate-screenshot.c @@ -126,16 +126,10 @@ display_help (GtkWindow *parent) { GError *error = NULL; -#if GTK_CHECK_VERSION (3, 22, 0) gtk_show_uri_on_window (parent, "help:mate-user-guide/goseditmainmenu-53", gtk_get_current_event_time (), &error); -#else - gtk_show_uri (gtk_window_get_screen (parent), - "help:mate-user-guide/goseditmainmenu-53", - gtk_get_current_event_time (), &error); -#endif if (error) { @@ -339,12 +333,8 @@ create_effects_frame (GtkWidget *outer_vbox, title = g_strconcat ("<b>", frame_title, "</b>", NULL); label = gtk_label_new (title); gtk_label_set_use_markup (GTK_LABEL (label), TRUE); -#if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (label), 0.0); gtk_label_set_yalign (GTK_LABEL (label), 0.5); -#else - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); -#endif gtk_box_pack_start (GTK_BOX (main_vbox), label, FALSE, FALSE, 0); gtk_widget_show (label); g_free (title); @@ -385,12 +375,8 @@ create_effects_frame (GtkWidget *outer_vbox, label = gtk_label_new_with_mnemonic (_("Apply _effect:")); gtk_widget_set_sensitive (label, take_window_shot); -#if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (label), 0.0); gtk_label_set_yalign (GTK_LABEL (label), 0.5); -#else - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); -#endif gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); gtk_widget_show (label); effect_label = label; @@ -423,12 +409,8 @@ create_screenshot_frame (GtkWidget *outer_vbox, title = g_strconcat ("<b>", frame_title, "</b>", NULL); label = gtk_label_new (title); gtk_label_set_use_markup (GTK_LABEL (label), TRUE); -#if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (label), 0.0); gtk_label_set_yalign (GTK_LABEL (label), 0.5); -#else - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); -#endif gtk_box_pack_start (GTK_BOX (main_vbox), label, FALSE, FALSE, 0); gtk_widget_show (label); g_free (title); @@ -494,12 +476,8 @@ create_screenshot_frame (GtkWidget *outer_vbox, * delay of <spin button> seconds". */ label = gtk_label_new_with_mnemonic (_("Grab _after a delay of")); -#if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (label), 0.0); gtk_label_set_yalign (GTK_LABEL (label), 0.5); -#else - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); -#endif gtk_box_pack_start (GTK_BOX (delay_hbox), label, FALSE, FALSE, 0); gtk_widget_show (label); @@ -519,12 +497,8 @@ create_screenshot_frame (GtkWidget *outer_vbox, * delay of <spin button> seconds". */ label = gtk_label_new (_("seconds")); -#if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (label), 0.0); gtk_label_set_yalign (GTK_LABEL (label), 0.5); -#else - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); -#endif gtk_box_pack_end (GTK_BOX (delay_hbox), label, FALSE, FALSE, 0); gtk_widget_show (label); } diff --git a/mate-screenshot/src/screenshot-utils.c b/mate-screenshot/src/screenshot-utils.c index b6539c85..d565fffe 100644 --- a/mate-screenshot/src/screenshot-utils.c +++ b/mate-screenshot/src/screenshot-utils.c @@ -160,23 +160,14 @@ GdkWindow * screenshot_find_current_window () { GdkWindow *current_window; -#if GTK_CHECK_VERSION (3, 20, 0) GdkDisplay *display; GdkSeat *seat; -#else - GdkDeviceManager *manager; -#endif GdkDevice *device; current_window = screenshot_find_active_window (); -#if GTK_CHECK_VERSION (3, 20, 0) display = gdk_window_get_display (current_window); seat = gdk_display_get_default_seat (display); device = gdk_seat_get_pointer (seat); -#else - manager = gdk_display_get_device_manager (gdk_display_get_default ()); - device = gdk_device_manager_get_client_pointer (manager); -#endif /* If there's no active window, we fall back to returning the * window that the cursor is in. @@ -389,12 +380,7 @@ screenshot_select_area_async (SelectAreaCallback callback) { GdkDisplay *display; GdkCursor *cursor; -#if GTK_CHECK_VERSION (3, 20, 0) GdkSeat *seat; -#else - GdkDeviceManager *manager; - GdkDevice *pointer, *keyboard; -#endif GdkGrabStatus res; select_area_filter_data data; GdkRectangle *rectangle; @@ -418,7 +404,6 @@ screenshot_select_area_async (SelectAreaCallback callback) display = gdk_display_get_default (); cursor = gdk_cursor_new_for_display (display, GDK_CROSSHAIR); -#if GTK_CHECK_VERSION (3, 20, 0) seat = gdk_display_get_default_seat (display); res = gdk_seat_grab (seat, @@ -439,41 +424,6 @@ screenshot_select_area_async (SelectAreaCallback callback) gtk_main (); gdk_seat_ungrab (seat); -#else - manager = gdk_display_get_device_manager (display); - pointer = gdk_device_manager_get_client_pointer (manager); - keyboard = gdk_device_get_associated_device (pointer); - - res = gdk_device_grab (pointer, gtk_widget_get_window (data.window), - GDK_OWNERSHIP_NONE, FALSE, - GDK_POINTER_MOTION_MASK | - GDK_BUTTON_PRESS_MASK | - GDK_BUTTON_RELEASE_MASK, - cursor, GDK_CURRENT_TIME); - - if (res != GDK_GRAB_SUCCESS) - { - g_object_unref (cursor); - goto out; - } - - res = gdk_device_grab (keyboard, gtk_widget_get_window (data.window), - GDK_OWNERSHIP_NONE, FALSE, - GDK_KEY_PRESS_MASK | - GDK_KEY_RELEASE_MASK, - NULL, GDK_CURRENT_TIME); - if (res != GDK_GRAB_SUCCESS) - { - gdk_device_ungrab (pointer, GDK_CURRENT_TIME); - g_object_unref (cursor); - goto out; - } - - gtk_main (); - - gdk_device_ungrab (keyboard, GDK_CURRENT_TIME); - gdk_device_ungrab (pointer, GDK_CURRENT_TIME); -#endif gtk_widget_destroy (data.window); g_object_unref (cursor); @@ -515,19 +465,13 @@ find_wm_window (Window xid) static cairo_region_t * make_region_with_monitors (GdkScreen *screen) { -#if GTK_CHECK_VERSION (3, 22, 0) GdkDisplay *display; -#endif cairo_region_t *region; int num_monitors; int i; -#if GTK_CHECK_VERSION (3, 22, 0) display = gdk_screen_get_display (screen); num_monitors = gdk_display_get_n_monitors (display); -#else - num_monitors = gdk_screen_get_n_monitors (screen); -#endif region = cairo_region_create (); @@ -535,11 +479,7 @@ make_region_with_monitors (GdkScreen *screen) { GdkRectangle rect; -#if GTK_CHECK_VERSION (3, 22, 0) gdk_monitor_get_geometry (gdk_display_get_monitor (display, i), &rect); -#else - gdk_screen_get_monitor_geometry (screen, i, &rect); -#endif cairo_region_union_rectangle (region, &rect); } @@ -839,24 +779,16 @@ screenshot_get_pixbuf (GdkWindow *window, if (cursor_pixbuf != NULL) { -#if GTK_CHECK_VERSION (3, 20, 0) GdkDisplay *display; GdkSeat *seat; -#else - GdkDeviceManager *manager; -#endif GdkDevice *device; GdkRectangle r1, r2; gint cx, cy, xhot, yhot; -#if GTK_CHECK_VERSION (3, 20, 0) display = gdk_window_get_display (window); seat = gdk_display_get_default_seat (display); device = gdk_seat_get_pointer (seat); -#else - manager = gdk_display_get_device_manager (gdk_display_get_default ()); - device = gdk_device_manager_get_client_pointer (manager); -#endif + gdk_window_get_device_position (window, device, &cx, &cy, NULL); sscanf (gdk_pixbuf_get_option (cursor_pixbuf, "x_hot"), "%d", &xhot); sscanf (gdk_pixbuf_get_option (cursor_pixbuf, "y_hot"), "%d", &yhot); |