[gdm: 60/70] Work better in broken randr fake clone mode
- From: Ray Strode <halfline src gnome org>
- To: svn-commits-list gnome org
- Subject: [gdm: 60/70] Work better in broken randr fake clone mode
- Date: Tue, 31 Mar 2009 14:55:48 -0400 (EDT)
commit 6f91becfff4024a180771b3bc4e78dd47cabab1f
Author: Ray Strode <rstrode redhat com>
Date: Fri Feb 20 02:46:40 2009 +0000
Work better in broken randr fake clone mode
2009-02-19 Ray Strode <rstrode redhat com>
Work better in broken randr fake clone mode
* gui/simple-greeter/gdm-greeter-panel.c
(get_outside_region), (get_monitor_geometry): drop
(update_struts), (update_geometry):
and just use gdk_screen_get_monitor_geometry.
The logic here is wrong, so let's just solve this
problem in a different way.
* gui/simple-greeter/gdm-greeter-session.c
(get_tallest_monitor_at_point), (toggle_panel):
When picking a monitor, don't pick the first
one in the unsorted list that happens to be
under the pointer, but instead pick the tallest
one in the list that's under the pointer.
svn path=/trunk/; revision=6720
---
ChangeLog | 18 +++++++++++
gui/simple-greeter/gdm-greeter-panel.c | 48 ++++--------------------------
gui/simple-greeter/gdm-greeter-session.c | 40 ++++++++++++++++++++++++-
3 files changed, 63 insertions(+), 43 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f672282..0940a79 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2009-02-19 Ray Strode <rstrode redhat com>
+
+ Work better in broken randr fake clone mode
+
+ * gui/simple-greeter/gdm-greeter-panel.c
+ (get_outside_region), (get_monitor_geometry): drop
+ (update_struts), (update_geometry):
+ and just use gdk_screen_get_monitor_geometry.
+ The logic here is wrong, so let's just solve this
+ problem in a different way.
+
+ * gui/simple-greeter/gdm-greeter-session.c
+ (get_tallest_monitor_at_point), (toggle_panel):
+ When picking a monitor, don't pick the first
+ one in the unsorted list that happens to be
+ under the pointer, but instead pick the tallest
+ one in the list that's under the pointer.
+
2009-02-17 Brian Cameron <brian cameron sun com>
* common/gdm-settings-direct.[ch], common/gdm-settings-keys.h,
diff --git a/gui/simple-greeter/gdm-greeter-panel.c b/gui/simple-greeter/gdm-greeter-panel.c
index 874b802..6aded10 100644
--- a/gui/simple-greeter/gdm-greeter-panel.c
+++ b/gui/simple-greeter/gdm-greeter-panel.c
@@ -232,46 +232,6 @@ gdm_greeter_panel_real_unrealize (GtkWidget *widget)
}
}
-static GdkRegion *
-get_outside_region (GdmGreeterPanel *panel)
-{
- int i;
- GdkRegion *region;
-
- region = gdk_region_new ();
- for (i = 0; i < panel->priv->monitor; i++) {
- GdkRectangle geometry;
-
- gdk_screen_get_monitor_geometry (GTK_WINDOW (panel)->screen,
- i,
- &geometry);
- gdk_region_union_with_rect (region, &geometry);
- }
-
- return region;
-}
-
-static void
-get_monitor_geometry (GdmGreeterPanel *panel,
- GdkRectangle *geometry)
-{
- GdkRegion *outside_region;
- GdkRegion *monitor_region;
- GdkRectangle geom;
-
- outside_region = get_outside_region (panel);
-
- gdk_screen_get_monitor_geometry (GTK_WINDOW (panel)->screen,
- panel->priv->monitor,
- &geom);
- monitor_region = gdk_region_rectangle (&geom);
- gdk_region_subtract (monitor_region, outside_region);
- gdk_region_destroy (outside_region);
-
- gdk_region_get_clipbox (monitor_region, geometry);
- gdk_region_destroy (monitor_region);
-}
-
static void
set_struts (GdmGreeterPanel *panel,
int x,
@@ -332,7 +292,9 @@ update_struts (GdmGreeterPanel *panel)
{
GdkRectangle geometry;
- get_monitor_geometry (panel, &geometry);
+ gdk_screen_get_monitor_geometry (GTK_WINDOW (panel)->screen,
+ panel->priv->monitor,
+ &geometry);
/* FIXME: assumes only one panel */
set_struts (panel,
@@ -348,7 +310,9 @@ update_geometry (GdmGreeterPanel *panel,
{
GdkRectangle geometry;
- get_monitor_geometry (panel, &geometry);
+ gdk_screen_get_monitor_geometry (GTK_WINDOW (panel)->screen,
+ panel->priv->monitor,
+ &geometry);
panel->priv->geometry.width = geometry.width;
panel->priv->geometry.height = requisition->height + 2 * GTK_CONTAINER (panel)->border_width;
diff --git a/gui/simple-greeter/gdm-greeter-session.c b/gui/simple-greeter/gdm-greeter-session.c
index 83375b2..0b81a40 100644
--- a/gui/simple-greeter/gdm-greeter-session.c
+++ b/gui/simple-greeter/gdm-greeter-session.c
@@ -267,6 +267,43 @@ on_start_session (GdmGreeterLoginWindow *login_window,
gdm_greeter_client_call_start_session_when_ready (session->priv->client, TRUE);
}
+static int
+get_tallest_monitor_at_point (GdkScreen *screen,
+ int x,
+ int y)
+{
+ GdkRectangle area;
+ GdkRegion *region;
+ int i;
+ int monitor;
+ int n_monitors;
+ int tallest_height;
+
+ monitor = gdk_screen_get_monitor_at_point (screen, x, y);
+
+ tallest_height = 0;
+ n_monitors = gdk_screen_get_n_monitors (screen);
+ monitor = -1;
+ for (i = 0; i < n_monitors; i++) {
+ gdk_screen_get_monitor_geometry (screen, i, &area);
+ region = gdk_region_rectangle (&area);
+
+ if (gdk_region_point_in (region, x, y)) {
+ if (area.height > tallest_height) {
+ monitor = i;
+ tallest_height = area.height;
+ }
+ }
+ gdk_region_destroy (region);
+ }
+
+ if (monitor == -1) {
+ monitor = gdk_screen_get_monitor_at_point (screen, x, y);
+ }
+
+ return monitor;
+}
+
static void
toggle_panel (GdmGreeterSession *session,
gboolean enabled)
@@ -281,7 +318,8 @@ toggle_panel (GdmGreeterSession *session,
display = gdk_display_get_default ();
gdk_display_get_pointer (display, &screen, &x, &y, NULL);
- monitor = gdk_screen_get_monitor_at_point (screen, x, y);
+
+ monitor = get_tallest_monitor_at_point (screen, x, y);
session->priv->panel = gdm_greeter_panel_new (screen, monitor);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]