[gtk+/wip/matthiasc/monitor] A bunch more renaming
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/matthiasc/monitor] A bunch more renaming
- Date: Sun, 3 Apr 2016 14:51:09 +0000 (UTC)
commit 7c81188f654e84609c1e6af43fe361a7bc4ec62d
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Apr 2 15:48:34 2016 -0400
A bunch more renaming
gdk/gdkmonitor.c | 57 +++++++++++++++++++++++++++++---------
gdk/gdkmonitor.h | 2 +-
gdk/gdkmonitorprivate.h | 13 +++++---
gdk/gdkscreen.c | 4 +-
gdk/wayland/gdkscreen-wayland.c | 13 ++-------
5 files changed, 57 insertions(+), 32 deletions(-)
---
diff --git a/gdk/gdkmonitor.c b/gdk/gdkmonitor.c
index 8b3c1f9..31fd282 100644
--- a/gdk/gdkmonitor.c
+++ b/gdk/gdkmonitor.c
@@ -206,9 +206,9 @@ gdk_monitor_get_geometry (GdkMonitor *monitor,
}
void
-gdk_monitor_get_size (GdkMonitor *monitor,
- int *width_mm,
- int *height_mm)
+gdk_monitor_get_physical_size (GdkMonitor *monitor,
+ int *width_mm,
+ int *height_mm)
{
g_return_if_fail (GDK_IS_MONITOR (monitor));
@@ -269,24 +269,53 @@ gdk_monitor_set_model (GdkMonitor *monitor,
}
void
-gdk_monitor_set_geometry (GdkMonitor *monitor,
+gdk_monitor_set_position (GdkMonitor *monitor,
int x,
- int y,
- int width,
- int height)
+ int y)
{
- monitor->geometry.x = x;
- monitor->geometry.y = y;
- monitor->geometry.height = height;
- monitor->geometry.width = width;
+ g_object_freeze_notify (G_OBJECT (monitor));
+
+ if (monitor->geometry.x != x)
+ {
+ monitor->geometry.x = x;
+ g_object_notify (G_OBJECT (monitor), "geometry");
+ }
- g_object_notify (G_OBJECT (monitor), "geometry");
+ if (monitor->geometry.y != y)
+ {
+ monitor->geometry.y = y;
+ g_object_notify (G_OBJECT (monitor), "geometry");
+ }
+
+ g_object_thaw_notify (G_OBJECT (monitor));
}
void
gdk_monitor_set_size (GdkMonitor *monitor,
- int width_mm,
- int height_mm)
+ int width,
+ int height)
+{
+ g_object_freeze_notify (G_OBJECT (monitor));
+
+ if (monitor->geometry.width != width)
+ {
+ monitor->geometry.width = width;
+ g_object_notify (G_OBJECT (monitor), "geometry");
+ }
+
+ if (monitor->geometry.height != height)
+ {
+ monitor->geometry.height = height;
+ g_object_notify (G_OBJECT (monitor), "geometry");
+ }
+
+ g_object_thaw_notify (G_OBJECT (monitor));
+}
+
+void
+gdk_monitor_set_physical_size (GdkMonitor *monitor,
+ int width_mm,
+ int height_mm)
{
g_object_freeze_notify (G_OBJECT (monitor));
diff --git a/gdk/gdkmonitor.h b/gdk/gdkmonitor.h
index d405dbf..208dcb9 100644
--- a/gdk/gdkmonitor.h
+++ b/gdk/gdkmonitor.h
@@ -49,7 +49,7 @@ GDK_AVAILABLE_IN_3_22
void gdk_monitor_get_geometry (GdkMonitor *monitor,
GdkRectangle *geometry);
GDK_AVAILABLE_IN_3_22
-void gdk_monitor_get_size (GdkMonitor *monitor,
+void gdk_monitor_get_physical_size (GdkMonitor *monitor,
int *width_mm,
int *height_mm);
GDK_AVAILABLE_IN_3_22
diff --git a/gdk/gdkmonitorprivate.h b/gdk/gdkmonitorprivate.h
index cf8859d..bc15c25 100644
--- a/gdk/gdkmonitorprivate.h
+++ b/gdk/gdkmonitorprivate.h
@@ -28,11 +28,11 @@ struct _GdkMonitor {
GObject parent;
GdkDisplay *display;
+ char *manufacturer;
+ char *model;
GdkRectangle geometry;
int width_mm;
int height_mm;
- char *manufacturer;
- char *model;
int scale_factor;
};
@@ -48,16 +48,19 @@ void gdk_monitor_set_manufacturer (GdkMonitor *monitor,
const char *manufacturer);
void gdk_monitor_set_model (GdkMonitor *monitor,
const char *model);
-void gdk_monitor_set_geometry (GdkMonitor *monitor,
+void gdk_monitor_set_position (GdkMonitor *monitor,
int x,
- int y,
+ int y);
+void gdk_monitor_set_size (GdkMonitor *monitor,
int width,
int height);
-void gdk_monitor_set_size (GdkMonitor *monitor,
+void gdk_monitor_set_physical_size (GdkMonitor *monitor,
int width_mm,
int height_mm);
void gdk_monitor_set_scale_factor (GdkMonitor *monitor,
int scale);
+void gdk_monitor_set_refresh_rate (GdkMonitor *monitor,
+ int refresh_rate);
G_END_DECLS
diff --git a/gdk/gdkscreen.c b/gdk/gdkscreen.c
index 3e2b618..9354f74 100644
--- a/gdk/gdkscreen.c
+++ b/gdk/gdkscreen.c
@@ -771,7 +771,7 @@ gdk_screen_real_get_monitor_width_mm (GdkScreen *screen,
int width_mm, height_mm;
monitor = get_monitor (screen, monitor_num);
- gdk_monitor_get_size (monitor, &width_mm, &height_mm);
+ gdk_monitor_get_physical_size (monitor, &width_mm, &height_mm);
return width_mm;
}
@@ -784,7 +784,7 @@ gdk_screen_real_get_monitor_height_mm (GdkScreen *screen,
int width_mm, height_mm;
monitor = get_monitor (screen, monitor_num);
- gdk_monitor_get_size (monitor, &width_mm, &height_mm);
+ gdk_monitor_get_physical_size (monitor, &width_mm, &height_mm);
return height_mm;
}
diff --git a/gdk/wayland/gdkscreen-wayland.c b/gdk/wayland/gdkscreen-wayland.c
index a9323fc..81f96e7 100644
--- a/gdk/wayland/gdkscreen-wayland.c
+++ b/gdk/wayland/gdkscreen-wayland.c
@@ -1080,11 +1080,8 @@ output_handle_geometry (void *data,
g_message ("handle geometry output %d, position %d %d, phys. size %d %d, subpixel layout %s,
manufacturer %s, model %s, transform %s",
monitor->id, x, y, physical_width, physical_height, subpixel_to_string (subpixel),
make, model, transform_to_string (transform)));
- gdk_monitor_set_geometry (GDK_MONITOR (monitor),
- x, y,
- GDK_MONITOR (monitor)->geometry.width,
- GDK_MONITOR (monitor)->geometry.height);
- gdk_monitor_set_size (GDK_MONITOR (monitor), physical_width, physical_height);
+ gdk_monitor_set_position (GDK_MONITOR (monitor), x, y);
+ gdk_monitor_set_physical_size (GDK_MONITOR (monitor), physical_width, physical_height);
gdk_monitor_set_manufacturer (GDK_MONITOR (monitor), make);
gdk_monitor_set_model (GDK_MONITOR (monitor), model);
@@ -1147,7 +1144,6 @@ output_handle_mode (void *data,
int refresh)
{
GdkWaylandMonitor *monitor = (GdkWaylandMonitor *)data;
- GdkRectangle geometry;
GDK_NOTE (MISC,
g_message ("handle mode output %d, size %d %d, rate %d",
@@ -1156,10 +1152,7 @@ output_handle_mode (void *data,
if ((flags & WL_OUTPUT_MODE_CURRENT) == 0)
return;
- gdk_monitor_get_geometry (GDK_MONITOR (monitor), &geometry);
- gdk_monitor_set_geometry (GDK_MONITOR (monitor),
- geometry.x, geometry.y,
- width, height);
+ gdk_monitor_set_size (GDK_MONITOR (monitor), width, height);
monitor->refresh_rate = refresh;
if (width != 0 && monitor->version < OUTPUT_VERSION_WITH_DONE)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]