[virt-tools-list] [PATCH virt-viewer 1/3] virt-viewer-window: Add helper for getting monitor geometry
Pavel Grunt
pgrunt at redhat.com
Thu May 14 14:36:32 UTC 2015
It will be used in following commit
---
src/virt-viewer-window.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
index d67fbc1..004eafd 100644
--- a/src/virt-viewer-window.c
+++ b/src/virt-viewer-window.c
@@ -71,6 +71,7 @@ static void virt_viewer_window_toolbar_setup(VirtViewerWindow *self);
static GtkMenu* virt_viewer_window_get_keycombo_menu(VirtViewerWindow *self);
static void virt_viewer_window_get_minimal_dimensions(VirtViewerWindow *self, guint *width, guint *height);
static gint virt_viewer_window_get_minimal_zoom_level(VirtViewerWindow *self);
+static void virt_viewer_window_get_monitor_geometry(VirtViewerWindow *self, GdkRectangle *geometry);
G_DEFINE_TYPE (VirtViewerWindow, virt_viewer_window, G_TYPE_OBJECT)
@@ -416,7 +417,6 @@ static void
virt_viewer_window_resize(VirtViewerWindow *self, gboolean keep_win_size)
{
GdkRectangle fullscreen;
- GdkScreen *screen;
int width, height;
double desktopAspect;
double screenAspect;
@@ -436,11 +436,7 @@ virt_viewer_window_resize(VirtViewerWindow *self, gboolean keep_win_size)
virt_viewer_display_get_desktop_size(VIRT_VIEWER_DISPLAY(priv->display),
&desktopWidth, &desktopHeight);
- screen = gtk_widget_get_screen(priv->window);
- gdk_screen_get_monitor_geometry(screen,
- gdk_screen_get_monitor_at_window
- (screen, gtk_widget_get_window(priv->window)),
- &fullscreen);
+ virt_viewer_window_get_monitor_geometry(self, &fullscreen);
g_return_if_fail(desktopWidth > 0);
g_return_if_fail(desktopHeight > 0);
@@ -1582,6 +1578,16 @@ virt_viewer_window_get_minimal_zoom_level(VirtViewerWindow *self)
return CLAMP(zoom * ZOOM_STEP, MIN_ZOOM_LEVEL, NORMAL_ZOOM_LEVEL);
}
+static void
+virt_viewer_window_get_monitor_geometry(VirtViewerWindow *self, GdkRectangle *geometry)
+{
+ GtkWidget *window = self->priv->window;
+ GdkScreen *screen = gtk_widget_get_screen(window);
+ gint monitor = gdk_screen_get_monitor_at_window(screen, gtk_widget_get_window(window));
+
+ gdk_screen_get_monitor_geometry(screen, monitor, geometry);
+}
+
/*
* Local variables:
* c-indent-level: 4
--
2.4.0
More information about the virt-tools-list
mailing list