[gnome-control-center/wip/carlosg/calibrator-fixes: 4/7] wacom: Pass GdkMonitor directly to calibrator object
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/wip/carlosg/calibrator-fixes: 4/7] wacom: Pass GdkMonitor directly to calibrator object
- Date: Sat, 12 Feb 2022 14:39:24 +0000 (UTC)
commit 078c9fedc705a4e320d3f8eecd84be83886f0ec7
Author: Carlos Garnacho <carlosg gnome org>
Date: Thu Feb 10 00:08:12 2022 +0100
wacom: Pass GdkMonitor directly to calibrator object
Instead of figuring out a monitor number from a GdkMonitor, and
look the GdkMonitor back up, pass the GdkMonitor directly.
panels/wacom/calibrator/calibrator-gui.c | 11 +++++------
panels/wacom/calibrator/calibrator-gui.h | 2 +-
panels/wacom/calibrator/main.c | 2 +-
panels/wacom/cc-wacom-page.c | 15 +--------------
4 files changed, 8 insertions(+), 22 deletions(-)
---
diff --git a/panels/wacom/calibrator/calibrator-gui.c b/panels/wacom/calibrator/calibrator-gui.c
index fd96882fc..cde307555 100644
--- a/panels/wacom/calibrator/calibrator-gui.c
+++ b/panels/wacom/calibrator/calibrator-gui.c
@@ -340,7 +340,7 @@ cc_calib_area_init (CcCalibArea *calib_area)
*/
CcCalibArea *
cc_calib_area_new (GdkDisplay *display,
- int n_monitor,
+ GdkMonitor *monitor,
GdkDevice *device,
FinishCallback callback,
gpointer user_data,
@@ -348,7 +348,6 @@ cc_calib_area_new (GdkDisplay *display,
int threshold_misclick)
{
CcCalibArea *calib_area;
- g_autoptr(GdkMonitor) monitor = NULL;
g_return_val_if_fail (callback, NULL);
@@ -360,11 +359,11 @@ cc_calib_area_new (GdkDisplay *display,
calib_area->calibrator.threshold_misclick = threshold_misclick;
/* Move to correct screen */
- if (display == NULL)
- display = gdk_display_get_default ();
- monitor = g_list_model_get_item (gdk_display_get_monitors (display), n_monitor);
+ if (monitor)
+ gtk_window_fullscreen_on_monitor (GTK_WINDOW (calib_area), monitor);
+ else
+ gtk_window_fullscreen (GTK_WINDOW (calib_area));
- gtk_window_fullscreen_on_monitor (GTK_WINDOW (calib_area), monitor);
gtk_widget_show (GTK_WIDGET (calib_area));
return calib_area;
diff --git a/panels/wacom/calibrator/calibrator-gui.h b/panels/wacom/calibrator/calibrator-gui.h
index 4c102785d..5d6d1ae9a 100644
--- a/panels/wacom/calibrator/calibrator-gui.h
+++ b/panels/wacom/calibrator/calibrator-gui.h
@@ -42,7 +42,7 @@ G_DECLARE_FINAL_TYPE (CcCalibArea, cc_calib_area, CC, CALIB_AREA, GtkWindow)
typedef void (*FinishCallback) (CcCalibArea *area, gpointer user_data);
CcCalibArea * cc_calib_area_new (GdkDisplay *display,
- int monitor,
+ GdkMonitor *monitor,
GdkDevice *device,
FinishCallback callback,
gpointer user_data,
diff --git a/panels/wacom/calibrator/main.c b/panels/wacom/calibrator/main.c
index cf423f245..71421c7ed 100644
--- a/panels/wacom/calibrator/main.c
+++ b/panels/wacom/calibrator/main.c
@@ -403,7 +403,7 @@ int main(int argc, char** argv)
g_setenv ("G_MESSAGES_DEBUG", "all", TRUE);
calib_area = cc_calib_area_new (NULL,
- 0, /* monitor */
+ NULL, /* monitor */
NULL, /* NULL to accept input from any device */
calibration_finished_cb,
NULL,
diff --git a/panels/wacom/cc-wacom-page.c b/panels/wacom/cc-wacom-page.c
index 1aaf7b565..0753e6e8f 100644
--- a/panels/wacom/cc-wacom-page.c
+++ b/panels/wacom/cc-wacom-page.c
@@ -217,23 +217,10 @@ run_calibration (CcWacomPage *page,
gdouble *cal,
GdkMonitor *monitor)
{
- GdkDisplay *display = gdk_monitor_get_display (monitor);
- GListModel *monitors;
- guint i, n_monitor = 0;
-
g_assert (page->area == NULL);
- monitors = gdk_display_get_monitors (display);
- for (i = 0; i < g_list_model_get_n_items (monitors); i++) {
- g_autoptr(GdkMonitor) m = g_list_model_get_item (monitors, i);
- if (monitor == m) {
- n_monitor = i;
- break;
- }
- }
-
page->area = cc_calib_area_new (NULL,
- n_monitor,
+ monitor,
cc_wacom_page_get_gdk_device (page),
finish_calibration,
page,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]