Commit 4adeed72 authored by monsta's avatar monsta Committed by raveit65

require GTK+ 3.22 and GLib 2.50

parent c862d81d
......@@ -29,10 +29,6 @@ AC_SUBST(VERSION)
# Save flags to aclocal
ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
# GLib min required versions
AC_DEFINE([GLIB_VERSION_MIN_REQUIRED], [GLIB_VERSION_2_36],
[Warn on use of APIs deprecated before GLib 2.36])
GETTEXT_PACKAGE=mate-screensaver
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Name of default gettext domain])
......@@ -48,8 +44,8 @@ GLIB_GSETTINGS
# Dependencies
DBUS_REQUIRED_VERSION=0.30
GLIB_REQUIRED_VERSION=2.36.0
GTK_REQUIRED_VERSION=3.14.0
GLIB_REQUIRED_VERSION=2.50.0
GTK_REQUIRED_VERSION=3.22.0
X11_REQUIRED_VERSION=1.0
LIBMATE_MENU_REQUIRED_VERSION=1.10.0
MATE_DESKTOP_REQUIRED_VERSION=1.17.0
......
......@@ -72,10 +72,8 @@ grab_string (int status)
return "GrabNotViewable";
case GDK_GRAB_FROZEN:
return "GrabFrozen";
#if GTK_CHECK_VERSION (3, 16, 0)
case GDK_GRAB_FAILED:
return "GrabFailed";
#endif
default:
{
static char foo [255];
......@@ -152,7 +150,6 @@ xorg_lock_smasher_set_active (GSGrab *grab,
}
#endif /* HAVE_XF86MISCSETGRABKEYSSTATE */
#if GTK_CHECK_VERSION (3, 20, 0)
static void
prepare_window_grab_cb (GdkSeat *seat,
GdkWindow *window,
......@@ -160,7 +157,6 @@ prepare_window_grab_cb (GdkSeat *seat,
{
gdk_window_show_unraised (window);
}
#endif
static int
gs_grab_get (GSGrab *grab,
......@@ -170,10 +166,8 @@ gs_grab_get (GSGrab *grab,
gboolean hide_cursor)
{
GdkGrabStatus status;
#if GTK_CHECK_VERSION (3, 20, 0)
GdkSeat *seat;
GdkSeatCapabilities caps;
#endif
GdkCursor *cursor;
g_return_val_if_fail (window != NULL, FALSE);
......@@ -183,7 +177,6 @@ gs_grab_get (GSGrab *grab,
gs_debug ("Grabbing devices for window=%X", (guint32) GDK_WINDOW_XID (window));
#if GTK_CHECK_VERSION (3, 20, 0)
seat = gdk_display_get_default_seat (display);
if (!no_pointer_grab)
caps = GDK_SEAT_CAPABILITY_ALL;
......@@ -210,31 +203,6 @@ gs_grab_get (GSGrab *grab,
(hide_cursor ? cursor : NULL),
NULL, NULL, NULL);
}
#else
status = gdk_keyboard_grab (window, FALSE, GDK_CURRENT_TIME);
if (status == GDK_GRAB_SUCCESS && !no_pointer_grab)
{
GdkGrabStatus pstatus;
pstatus = gdk_pointer_grab (window, TRUE, 0, NULL,
(hide_cursor ? cursor : NULL),
GDK_CURRENT_TIME);
if (pstatus != GDK_GRAB_SUCCESS)
{
gdk_keyboard_ungrab (GDK_CURRENT_TIME);
if (status == GDK_GRAB_SUCCESS)
{
status = pstatus;
}
}
}
else
{
gdk_pointer_ungrab (GDK_CURRENT_TIME);
}
#endif
if (status == GDK_GRAB_SUCCESS)
{
......@@ -273,25 +241,15 @@ gs_grab_reset (GSGrab *grab)
void
gs_grab_release (GSGrab *grab, gboolean flush)
{
#if GTK_CHECK_VERSION (3, 20, 0)
GdkDisplay *display;
GdkSeat *seat;
display = gdk_display_get_default ();
seat = gdk_display_get_default_seat (display);
#endif
gs_debug ("Ungrabbing devices");
#if GTK_CHECK_VERSION (3, 20, 0)
gdk_seat_ungrab (seat);
#else
if (gdk_pointer_is_grabbed ())
{
gdk_pointer_ungrab (GDK_CURRENT_TIME);
}
gdk_keyboard_ungrab (GDK_CURRENT_TIME);
#endif
gs_grab_reset (grab);
......@@ -453,11 +411,7 @@ gs_grab_grab_root (GSGrab *grab,
gs_debug ("Grabbing the root window");
display = gdk_display_get_default ();
#if GTK_CHECK_VERSION (3, 20, 0)
device = gdk_seat_get_pointer (gdk_display_get_default_seat (display));
#else
device = gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (display));
#endif
gdk_device_get_position (device, &screen, NULL, NULL);
root = gdk_screen_get_root_window (screen);
......
......@@ -79,10 +79,6 @@ static void gs_lock_plug_finalize (GObject *object);
#define GS_LOCK_PLUG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GS_TYPE_LOCK_PLUG, GSLockPlugPrivate))
#if !GTK_CHECK_VERSION (3, 20, 0)
#define gtk_widget_set_focus_on_click(a, b) gtk_button_set_focus_on_click(GTK_BUTTON(a), b)
#endif
struct GSLockPlugPrivate
{
GtkWidget *vbox;
......@@ -1459,20 +1455,14 @@ logout_button_clicked (GtkButton *button,
void
gs_lock_plug_set_busy (GSLockPlug *plug)
{
#if GTK_CHECK_VERSION (3, 16, 0)
GdkDisplay *display;
#endif
GdkCursor *cursor;
GtkWidget *top_level;
top_level = gtk_widget_get_toplevel (GTK_WIDGET (plug));
#if GTK_CHECK_VERSION (3, 16, 0)
display = gtk_widget_get_display (GTK_WIDGET (plug));
cursor = gdk_cursor_new_for_display (display, GDK_WATCH);
#else
cursor = gdk_cursor_new (GDK_WATCH);
#endif
gdk_window_set_cursor (gtk_widget_get_window (top_level), cursor);
g_object_unref (cursor);
......@@ -1481,20 +1471,14 @@ gs_lock_plug_set_busy (GSLockPlug *plug)
void
gs_lock_plug_set_ready (GSLockPlug *plug)
{
#if GTK_CHECK_VERSION (3, 16, 0)
GdkDisplay *display;
#endif
GdkCursor *cursor;
GtkWidget *top_level;
top_level = gtk_widget_get_toplevel (GTK_WIDGET (plug));
#if GTK_CHECK_VERSION (3, 16, 0)
display = gtk_widget_get_display (GTK_WIDGET (plug));
cursor = gdk_cursor_new_for_display (display, GDK_LEFT_PTR);
#else
cursor = gdk_cursor_new (GDK_LEFT_PTR);
#endif
gdk_window_set_cursor (gtk_widget_get_window (top_level), cursor);
g_object_unref (cursor);
}
......@@ -1856,24 +1840,16 @@ create_page_one (GSLockPlug *plug)
str = g_strdup ("<span size=\"xx-large\" weight=\"ultrabold\">%s</span>");
plug->priv->auth_time_label = gtk_label_new (str);
g_free (str);
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (plug->priv->auth_time_label), 0.5);
gtk_label_set_yalign (GTK_LABEL (plug->priv->auth_time_label), 0.5);
#else
gtk_misc_set_alignment (GTK_MISC (plug->priv->auth_time_label), 0.5, 0.5);
#endif
gtk_label_set_use_markup (GTK_LABEL (plug->priv->auth_time_label), TRUE);
gtk_box_pack_start (GTK_BOX (vbox2), plug->priv->auth_time_label, FALSE, FALSE, 0);
str = g_strdup ("<span size=\"large\">%s</span>");
plug->priv->auth_date_label = gtk_label_new (str);
g_free (str);
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (plug->priv->auth_date_label), 0.5);
gtk_label_set_yalign (GTK_LABEL (plug->priv->auth_date_label), 0.5);
#else
gtk_misc_set_alignment (GTK_MISC (plug->priv->auth_date_label), 0.5, 0.5);
#endif
gtk_label_set_use_markup (GTK_LABEL (plug->priv->auth_date_label), TRUE);
gtk_box_pack_start (GTK_BOX (vbox2), plug->priv->auth_date_label, FALSE, FALSE, 0);
......@@ -1889,12 +1865,8 @@ create_page_one (GSLockPlug *plug)
plug->priv->auth_realname_label = gtk_label_new (str);
g_free (str);
expand_string_for_label (plug->priv->auth_realname_label);
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (plug->priv->auth_realname_label), 0.5);
gtk_label_set_yalign (GTK_LABEL (plug->priv->auth_realname_label), 0.5);
#else
gtk_misc_set_alignment (GTK_MISC (plug->priv->auth_realname_label), 0.5, 0.5);
#endif
gtk_label_set_use_markup (GTK_LABEL (plug->priv->auth_realname_label), TRUE);
gtk_box_pack_start (GTK_BOX (vbox2), plug->priv->auth_realname_label, FALSE, FALSE, 0);
......@@ -1903,12 +1875,8 @@ create_page_one (GSLockPlug *plug)
plug->priv->auth_username_label = gtk_label_new (str);
g_free (str);
expand_string_for_label (plug->priv->auth_username_label);
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (plug->priv->auth_realname_label), 0.5);
gtk_label_set_yalign (GTK_LABEL (plug->priv->auth_realname_label), 0.5);
#else
gtk_misc_set_alignment (GTK_MISC (plug->priv->auth_username_label), 0.5, 0.5);
#endif
gtk_label_set_use_markup (GTK_LABEL (plug->priv->auth_username_label), TRUE);
gtk_box_pack_start (GTK_BOX (vbox2), plug->priv->auth_username_label, FALSE, FALSE, 0);
......@@ -1919,12 +1887,8 @@ create_page_one (GSLockPlug *plug)
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
plug->priv->auth_prompt_label = gtk_label_new_with_mnemonic (_("_Password:"));
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (plug->priv->auth_prompt_label), 0.0);
gtk_label_set_yalign (GTK_LABEL (plug->priv->auth_prompt_label), 0.5);
#else
gtk_misc_set_alignment (GTK_MISC (plug->priv->auth_prompt_label), 0.0, 0.5);
#endif
gtk_box_pack_start (GTK_BOX (hbox), plug->priv->auth_prompt_label, FALSE, FALSE, 0);
plug->priv->auth_prompt_entry = gtk_entry_new ();
......@@ -1934,12 +1898,8 @@ create_page_one (GSLockPlug *plug)
plug->priv->auth_prompt_entry);
plug->priv->auth_capslock_label = gtk_label_new ("");
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (plug->priv->auth_capslock_label), 0.5);
gtk_label_set_yalign (GTK_LABEL (plug->priv->auth_capslock_label), 0.5);
#else
gtk_misc_set_alignment (GTK_MISC (plug->priv->auth_capslock_label), 0.5, 0.5);
#endif
gtk_box_pack_start (GTK_BOX (vbox2), plug->priv->auth_capslock_label, FALSE, FALSE, 0);
/* Status text */
......
......@@ -1103,30 +1103,16 @@ find_window_at_pointer (GSManager *manager)
{
GdkDisplay *display;
GdkDevice *device;
#if GTK_CHECK_VERSION (3, 22, 0)
GdkMonitor *monitor;
#else
GdkScreen *screen;
int monitor;
#endif
int x, y;
GSWindow *window;
GSList *l;
display = gdk_display_get_default ();
#if GTK_CHECK_VERSION (3, 20, 0)
device = gdk_seat_get_pointer (gdk_display_get_default_seat (display));
#else
device = gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (display));
#endif
#if GTK_CHECK_VERSION (3, 22, 0)
gdk_device_get_position (device, NULL, &x, &y);
monitor = gdk_display_get_monitor_at_point (display, x, y);
#else
gdk_device_get_position (device, &screen, &x, &y);
monitor = gdk_screen_get_monitor_at_point (screen, x, y);
#endif
/* Find the gs-window that is on that monitor */
window = NULL;
......@@ -1179,28 +1165,14 @@ manager_maybe_grab_window (GSManager *manager,
{
GdkDisplay *display;
GdkDevice *device;
#if GTK_CHECK_VERSION (3, 22, 0)
GdkMonitor *monitor;
#else
GdkScreen *screen;
int monitor;
#endif
int x, y;
gboolean grabbed;
display = gdk_display_get_default ();
#if GTK_CHECK_VERSION (3, 20, 0)
device = gdk_seat_get_pointer (gdk_display_get_default_seat (display));
#else
device = gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (display));
#endif
#if GTK_CHECK_VERSION (3, 22, 0)
gdk_device_get_position (device, NULL, &x, &y);
monitor = gdk_display_get_monitor_at_point (display, x, y);
#else
gdk_device_get_position (device, &screen, &x, &y);
monitor = gdk_screen_get_monitor_at_point (screen, x, y);
#endif
gdk_flush ();
grabbed = FALSE;
......@@ -1223,7 +1195,6 @@ window_grab_broken_cb (GSWindow *window,
GdkEventGrabBroken *event,
GSManager *manager)
{
#if GTK_CHECK_VERSION (3, 20, 0)
GdkDisplay *display;
GdkSeat *seat;
GdkDevice *device;
......@@ -1231,27 +1202,19 @@ window_grab_broken_cb (GSWindow *window,
display = gdk_window_get_display (gs_window_get_gdk_window (window));
seat = gdk_display_get_default_seat (display);
#endif
if (event->keyboard)
{
gs_debug ("KEYBOARD GRAB BROKEN!");
#if GTK_CHECK_VERSION (3, 20, 0)
device = gdk_seat_get_pointer (seat);
if (!gdk_display_device_is_grabbed (display, device))
gs_grab_reset (manager->priv->grab);
#else
if (!gdk_pointer_is_grabbed ())
gs_grab_reset (manager->priv->grab);
#endif
}
else
{
gs_debug ("POINTER GRAB BROKEN!");
#if GTK_CHECK_VERSION (3, 20, 0)
device = gdk_seat_get_keyboard (seat);
if (!gdk_display_device_is_grabbed (display, device))
gs_grab_reset (manager->priv->grab);
#endif
}
}
......@@ -1567,26 +1530,14 @@ connect_window_signals (GSManager *manager,
static void
gs_manager_create_window_for_monitor (GSManager *manager,
#if GTK_CHECK_VERSION (3, 22, 0)
GdkMonitor *monitor)
#else
GdkDisplay *display,
int monitor)
#endif
{
GSWindow *window;
#if GTK_CHECK_VERSION (3, 22, 0)
GdkDisplay *display;
#endif
GdkRectangle rect;
#if GTK_CHECK_VERSION (3, 22, 0)
display = gdk_monitor_get_display (monitor);
gdk_monitor_get_geometry (monitor, &rect);
#else
gdk_screen_get_monitor_geometry (gdk_display_get_default_screen (display),
monitor, &rect);
#endif
gs_debug ("Creating a window for the monitor [%d,%d] (%dx%d)",
monitor, rect.x, rect.y, rect.width, rect.height);
......@@ -1622,11 +1573,7 @@ on_screen_monitors_changed (GdkScreen *screen,
int i;
display = gdk_screen_get_display (screen);
#if GTK_CHECK_VERSION (3, 22, 0)
n_monitors = gdk_display_get_n_monitors (display);
#else
n_monitors = gdk_screen_get_n_monitors (screen);
#endif
n_windows = g_slist_length (manager->priv->windows);
gs_debug ("Monitors changed for display %s: num=%d",
......@@ -1649,13 +1596,8 @@ on_screen_monitors_changed (GdkScreen *screen,
/* add more windows */
for (i = n_windows; i < n_monitors; i++)
{
#if GTK_CHECK_VERSION (3, 22, 0)
GdkMonitor *mon = gdk_display_get_monitor (display, i);
gs_manager_create_window_for_monitor (manager, mon);
#else
gs_manager_create_window_for_monitor (manager,
display, i);
#endif
}
/* And put unlock dialog up where ever it's supposed to be
......@@ -1672,22 +1614,13 @@ on_screen_monitors_changed (GdkScreen *screen,
while (l != NULL)
{
GdkDisplay *this_display;
#if GTK_CHECK_VERSION (3, 22, 0)
GdkMonitor *this_monitor;
#else
int this_monitor;
#endif
GSList *next = l->next;
this_display = gs_window_get_display (GS_WINDOW (l->data));
this_monitor = gs_window_get_monitor (GS_WINDOW (l->data));
#if GTK_CHECK_VERSION (3, 22, 0)
if (this_display == display &&
!GDK_IS_MONITOR (this_monitor))
#else
if (this_display == display &&
this_monitor >= n_monitors)
#endif
{
manager_maybe_stop_job_for_window (manager, GS_WINDOW (l->data));
g_hash_table_remove (manager->priv->jobs, l->data);
......@@ -1784,9 +1717,6 @@ static void
gs_manager_create_windows_for_display (GSManager *manager,
GdkDisplay *display)
{
#if !GTK_CHECK_VERSION (3, 22, 0)
GdkScreen *screen;
#endif
int n_monitors;
int i;
......@@ -1797,24 +1727,15 @@ gs_manager_create_windows_for_display (GSManager *manager,
g_object_ref (manager);
g_object_ref (display);
#if GTK_CHECK_VERSION (3, 22, 0)
n_monitors = gdk_display_get_n_monitors (display);
#else
screen = gdk_display_get_default_screen (display);
n_monitors = gdk_screen_get_n_monitors (screen);
#endif
gs_debug ("Creating %d windows for display %s",
n_monitors, gdk_display_get_name (display));
for (i = 0; i < n_monitors; i++)
{
#if GTK_CHECK_VERSION (3, 22, 0)
GdkMonitor *mon = gdk_display_get_monitor (display, i);
gs_manager_create_window_for_monitor (manager, mon);
#else
gs_manager_create_window_for_monitor (manager, display, i);
#endif
}
g_object_unref (display);
......
......@@ -62,11 +62,7 @@ enum
struct GSWindowPrivate
{
#if GTK_CHECK_VERSION (3, 22, 0)
GdkMonitor *monitor;
#else
int monitor;
#endif
GdkRectangle geometry;
guint obscured : 1;
......@@ -152,20 +148,13 @@ static void
set_invisible_cursor (GdkWindow *window,
gboolean invisible)
{
#if GTK_CHECK_VERSION (3, 16, 0)
GdkDisplay *display;
#endif
GdkCursor *cursor = NULL;
if (invisible)
{
#if GTK_CHECK_VERSION (3, 16, 0)
display = gdk_window_get_display (window);
cursor = gdk_cursor_new_for_display (display, GDK_BLANK_CURSOR);
#else
cursor = gdk_cursor_new (GDK_BLANK_CURSOR);
#endif
}
gdk_window_set_cursor (window, cursor);
......@@ -303,56 +292,35 @@ static cairo_region_t *
get_outside_region (GSWindow *window)
{
GdkDisplay *display;
#if GTK_CHECK_VERSION (3, 22, 0)
int i;
int num_monitors;
#else
GdkScreen *screen;
int mon;
#endif
cairo_region_t *region;
display = gtk_widget_get_display (GTK_WIDGET (window));
#if !GTK_CHECK_VERSION (3, 22, 0)
screen = gdk_display_get_default_screen (display);
#endif
region = cairo_region_create ();
#if GTK_CHECK_VERSION (3, 22, 0)
num_monitors = gdk_display_get_n_monitors (display);
for (i = 0; i < num_monitors; i++)
#else
for (mon = 0; mon < window->priv->monitor; mon++)
#endif
{
#if GTK_CHECK_VERSION (3, 22, 0)
GdkMonitor *mon = gdk_display_get_monitor (display, i);
if (mon != window->priv->monitor)
{
#endif
GdkRectangle geometry;
cairo_rectangle_int_t rectangle;
#if GTK_CHECK_VERSION (3, 22, 0)
gdk_monitor_get_geometry (mon, &geometry);
#else
gdk_screen_get_monitor_geometry (screen, mon,
&geometry);
#endif
rectangle.x = geometry.x;
rectangle.y = geometry.y;
rectangle.width = geometry.width;
rectangle.height = geometry.height;
cairo_region_union_rectangle (region, &rectangle);
#if GTK_CHECK_VERSION (3, 22, 0)
}
else
{
break;
}
#endif
}
return region;
......@@ -367,13 +335,7 @@ update_geometry (GSWindow *window)
outside_region = get_outside_region (window);
#if GTK_CHECK_VERSION (3, 22, 0)
gdk_monitor_get_geometry (window->priv->monitor, &geometry);
#else
gdk_screen_get_monitor_geometry (gtk_widget_get_screen (GTK_WIDGET (window)),
window->priv->monitor,
&geometry);
#endif
gs_debug ("got geometry for monitor: x=%d y=%d w=%d h=%d",
geometry.x,
geometry.y,
......@@ -1949,11 +1911,7 @@ gs_window_set_status_message (GSWindow *window,
void
gs_window_set_monitor (GSWindow *window,
#if GTK_CHECK_VERSION (3, 22, 0)
GdkMonitor *monitor)
#else
int monitor)
#endif
{
g_return_if_fail (GS_IS_WINDOW (window));
......@@ -1969,18 +1927,10 @@ gs_window_set_monitor (GSWindow *window,
g_object_notify (G_OBJECT (window), "monitor");
}
#if GTK_CHECK_VERSION (3, 22, 0)
GdkMonitor *
#else
int
#endif
gs_window_get_monitor (GSWindow *window)
{
#if GTK_CHECK_VERSION (3, 22, 0)
g_return_val_if_fail (GS_IS_WINDOW (window), NULL);
#else
g_return_val_if_fail (GS_IS_WINDOW (window), -1);
#endif
return window->priv->monitor;
}
......@@ -2019,11 +1969,7 @@ gs_window_set_property (GObject *object,
gs_window_set_logout_timeout (self, g_value_get_long (value));
break;
case PROP_MONITOR:
#if GTK_CHECK_VERSION (3, 22, 0)
gs_window_set_monitor (self, g_value_get_pointer (value));
#else
gs_window_set_monitor (self, g_value_get_int (value));
#endif
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
......@@ -2065,11 +2011,7 @@ gs_window_get_property (GObject *object,
g_value_set_long (value, self->priv->logout_timeout);
break;
case PROP_MONITOR:
#if GTK_CHECK_VERSION (3, 22, 0)
g_value_set_pointer (value, (gpointer) self->priv->monitor);
#else
g_value_set_int (value, self->priv->monitor);
#endif
break;
case PROP_OBSCURED:
g_value_set_boolean (value, self->priv->obscured);
......@@ -2470,21 +2412,10 @@ gs_window_class_init (GSWindowClass *klass)
g_object_class_install_property (object_class,
PROP_MONITOR,
#if GTK_CHECK_VERSION (3, 22, 0)
g_param_spec_pointer ("monitor",
"Gdk monitor",
"The monitor (in terms of Gdk) which the window is on",
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
#else
g_param_spec_int ("monitor",
"RandR monitor",
"The monitor (in terms of RandR) which the window is on",
0,
G_MAXINT,
0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
#endif
}