Commit 14694981 authored by Alberts Muktupāvels's avatar Alberts Muktupāvels

clock: stop using deprecated API from GdkScreen

parent 850be6a5
......@@ -1235,6 +1235,21 @@ typedef struct
GtkWidget *tree;
} ConstraintData;
static void
get_monitor_geometry (GtkWidget *widget,
GdkRectangle *geometry)
{
GdkDisplay *display;
GdkWindow *window;
GdkMonitor *monitor;
display = gdk_display_get_default ();
window = gtk_widget_get_window (widget);
monitor = gdk_display_get_monitor_at_window (display, window);
gdk_monitor_get_geometry (monitor, geometry);
}
static void
constrain_list_size (GtkWidget *widget,
GtkAllocation *allocation,
......@@ -1244,7 +1259,7 @@ constrain_list_size (GtkWidget *widget,
GtkStyleContext *context;
GtkStateFlags state;
GtkBorder padding;
int screen_h;
GdkRectangle monitor;
int width;
int height;
int max_height;
......@@ -1253,9 +1268,10 @@ constrain_list_size (GtkWidget *widget,
gtk_widget_get_preferred_size (constraint->calendar, &req, NULL);
width = MIN (allocation->width, req.width);
screen_h = gdk_screen_get_height (gtk_widget_get_screen (widget));
get_monitor_geometry (widget, &monitor);
/* constrain height to be the tree height up to a max */
max_height = (screen_h - req.height) / 3;
max_height = (monitor.height - req.height) / 3;
gtk_widget_get_preferred_size (constraint->tree, &req, NULL);
state = gtk_widget_get_state_flags (widget);
......
......@@ -406,19 +406,31 @@ create_calendar (ClockData *cd)
return window;
}
static void
get_monitor_geometry (ClockData *cd,
GdkRectangle *geometry)
{
GdkDisplay *display;
GdkWindow *window;
GdkMonitor *monitor;
display = gdk_display_get_default ();
window = gtk_widget_get_window (cd->panel_button);
monitor = gdk_display_get_monitor_at_window (display, window);
gdk_monitor_get_geometry (monitor, geometry);
}
static void
position_calendar_popup (ClockData *cd)
{
GtkRequisition req;
GtkAllocation allocation;
GdkScreen *screen;
GdkRectangle monitor;
GdkGravity gravity = GDK_GRAVITY_NORTH_WEST;
int button_w, button_h;
int x, y;
int w, h;
int i, n;
gboolean found_monitor = FALSE;
/* Get root origin of the toggle button, and position above that. */
gdk_window_get_origin (gtk_widget_get_window (cd->panel_button),
......@@ -433,26 +445,7 @@ position_calendar_popup (ClockData *cd)
button_w = allocation.width;
button_h = allocation.height;
screen = gtk_window_get_screen (GTK_WINDOW (cd->calendar_popup));
n = gdk_screen_get_n_monitors (screen);
for (i = 0; i < n; i++) {
gdk_screen_get_monitor_geometry (screen, i, &monitor);
if (x >= monitor.x && x <= monitor.x + monitor.width &&
y >= monitor.y && y <= monitor.y + monitor.height) {
found_monitor = TRUE;
break;
}
}
if (!found_monitor) {
/* eek, we should be on one of those xinerama
monitors */
monitor.x = 0;
monitor.y = 0;
monitor.width = gdk_screen_get_width (screen);
monitor.height = gdk_screen_get_height (screen);
}
get_monitor_geometry (cd, &monitor);
/* Based on panel orientation, position the popup.
* Ignore window gravity since the window is undecorated.
......@@ -497,6 +490,9 @@ position_calendar_popup (ClockData *cd)
gravity = GDK_GRAVITY_SOUTH_WEST;
break;
default:
g_assert_not_reached ();
break;
}
......
......@@ -94,7 +94,7 @@ LIBGNOME_DESKTOP_REQUIRED=2.91.0
GDK_PIXBUF_REQUIRED=2.25.2
PANGO_REQUIRED=1.15.4
GLIB_REQUIRED=2.45.3
GTK_REQUIRED=3.19.6
GTK_REQUIRED=3.22.0
LIBWNCK_REQUIRED=3.4.6
LIBGNOME_MENU_REQUIRED=3.7.90
LIBECAL_REQUIRED=3.5.3
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment