wacom: Use GdkMonitor API on calibrator UI

Replaces usage of deprecated GdkScreen API. We still have to pass
monitor numbers around for gdk_window_fullscreen_on_monitor(), such
is life.
This commit is contained in:
Carlos Garnacho 2018-05-26 10:05:19 +02:00
parent c3b34e6798
commit 35adc02d42
2 changed files with 19 additions and 8 deletions

View file

@ -665,7 +665,7 @@ set_up_stage (CalibArea *calib_area, ClutterActor *stage)
*/ */
CalibArea * CalibArea *
calib_area_new (GdkScreen *screen, calib_area_new (GdkScreen *screen,
int monitor, int n_monitor,
GdkDevice *device, GdkDevice *device,
FinishCallback callback, FinishCallback callback,
gpointer user_data, gpointer user_data,
@ -675,6 +675,7 @@ calib_area_new (GdkScreen *screen,
CalibArea *calib_area; CalibArea *calib_area;
GdkRectangle rect; GdkRectangle rect;
GdkVisual *visual; GdkVisual *visual;
GdkMonitor *monitor;
#ifndef FAKE_AREA #ifndef FAKE_AREA
GdkWindow *window; GdkWindow *window;
GdkCursor *cursor; GdkCursor *cursor;
@ -715,7 +716,8 @@ calib_area_new (GdkScreen *screen,
/* Move to correct screen */ /* Move to correct screen */
if (screen == NULL) if (screen == NULL)
screen = gdk_screen_get_default (); screen = gdk_screen_get_default ();
gdk_screen_get_monitor_geometry (screen, monitor, &rect); monitor = gdk_display_get_monitor (gdk_screen_get_display (screen), n_monitor);
gdk_monitor_get_geometry (monitor, &rect);
calib_area->calibrator.geometry = rect; calib_area->calibrator.geometry = rect;
@ -742,7 +744,7 @@ calib_area_new (GdkScreen *screen,
G_CALLBACK (on_button_press_event), G_CALLBACK (on_button_press_event),
calib_area); calib_area);
gtk_window_fullscreen_on_monitor (GTK_WINDOW (calib_area->window), screen, monitor); gtk_window_fullscreen_on_monitor (GTK_WINDOW (calib_area->window), screen, n_monitor);
visual = gdk_screen_get_rgba_visual (screen); visual = gdk_screen_get_rgba_visual (screen);
if (visual != NULL) if (visual != NULL)

View file

@ -257,16 +257,25 @@ static gboolean
run_calibration (CcWacomPage *page, run_calibration (CcWacomPage *page,
GVariant *old_calibration, GVariant *old_calibration,
gdouble *cal, gdouble *cal,
gint monitor) GdkMonitor *monitor)
{ {
GdkDisplay *display = gdk_monitor_get_display (monitor);
CcWacomPagePrivate *priv; CcWacomPagePrivate *priv;
gint i, n_monitor = 0;
g_assert (page->priv->area == NULL); g_assert (page->priv->area == NULL);
priv = page->priv; priv = page->priv;
for (i = 0; i < gdk_display_get_n_monitors (display); i++) {
if (monitor == gdk_display_get_monitor (display, i)) {
n_monitor = i;
break;
}
}
priv->area = calib_area_new (NULL, priv->area = calib_area_new (NULL,
monitor, n_monitor,
cc_wacom_page_get_gdk_device (page), cc_wacom_page_get_gdk_device (page),
finish_calibration, finish_calibration,
page, page,
@ -289,7 +298,7 @@ calibrate (CcWacomPage *page)
GVariant *old_calibration, **tmp, *array; GVariant *old_calibration, **tmp, *array;
gdouble *calibration; gdouble *calibration;
gsize ncal; gsize ncal;
gint monitor; GdkMonitor *monitor;
GdkScreen *screen; GdkScreen *screen;
GnomeRRScreen *rr_screen; GnomeRRScreen *rr_screen;
GnomeRROutput *output; GnomeRROutput *output;
@ -308,9 +317,9 @@ calibrate (CcWacomPage *page)
output = cc_wacom_device_get_output (page->priv->stylus, rr_screen); output = cc_wacom_device_get_output (page->priv->stylus, rr_screen);
gnome_rr_output_get_position (output, &x, &y); gnome_rr_output_get_position (output, &x, &y);
monitor = gdk_screen_get_monitor_at_point (screen, x, y); monitor = gdk_display_get_monitor_at_point (gdk_screen_get_display (screen), x, y);
if (monitor < 0) { if (!monitor) {
/* The display the tablet should be mapped to could not be located. /* The display the tablet should be mapped to could not be located.
* This shouldn't happen if the EDID data is good... * This shouldn't happen if the EDID data is good...
*/ */