gdm r6397 - in trunk: . gui/simple-greeter
- From: mccann svn gnome org
- To: svn-commits-list gnome org
- Subject: gdm r6397 - in trunk: . gui/simple-greeter
- Date: Wed, 20 Aug 2008 20:44:50 +0000 (UTC)
Author: mccann
Date: Wed Aug 20 20:44:50 2008
New Revision: 6397
URL: http://svn.gnome.org/viewvc/gdm?rev=6397&view=rev
Log:
2008-08-20 William Jon McCann <jmccann redhat com>
* gui/simple-greeter/gdm-greeter-panel.c
(gdm_greeter_panel_set_monitor), (gdm_greeter_panel_set_property),
(gdm_greeter_panel_get_property), (gdm_greeter_panel_class_init),
(gdm_greeter_panel_new):
* gui/simple-greeter/gdm-greeter-panel.h:
* gui/simple-greeter/gdm-greeter-session.c (toggle_panel):
* gui/simple-greeter/test-greeter-panel.c (main):
Add monitor attribute and show panel on screen/monitor that has
the pointer.
Modified:
trunk/ChangeLog
trunk/gui/simple-greeter/gdm-greeter-panel.c
trunk/gui/simple-greeter/gdm-greeter-panel.h
trunk/gui/simple-greeter/gdm-greeter-session.c
trunk/gui/simple-greeter/test-greeter-panel.c
Modified: trunk/gui/simple-greeter/gdm-greeter-panel.c
==============================================================================
--- trunk/gui/simple-greeter/gdm-greeter-panel.c (original)
+++ trunk/gui/simple-greeter/gdm-greeter-panel.c Wed Aug 20 20:44:50 2008
@@ -65,6 +65,7 @@
enum {
PROP_0,
+ PROP_MONITOR
};
enum {
@@ -83,12 +84,36 @@
G_DEFINE_TYPE (GdmGreeterPanel, gdm_greeter_panel, GTK_TYPE_WINDOW)
static void
+gdm_greeter_panel_set_monitor (GdmGreeterPanel *panel,
+ int monitor)
+{
+ g_return_if_fail (GDM_IS_GREETER_PANEL (panel));
+
+ if (panel->priv->monitor == monitor) {
+ return;
+ }
+
+ panel->priv->monitor = monitor;
+
+ gtk_widget_queue_resize (GTK_WIDGET (panel));
+
+ g_object_notify (G_OBJECT (panel), "monitor");
+}
+
+static void
gdm_greeter_panel_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
+ GdmGreeterPanel *self;
+
+ self = GDM_GREETER_PANEL (object);
+
switch (prop_id) {
+ case PROP_MONITOR:
+ gdm_greeter_panel_set_monitor (self, g_value_get_int (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -101,7 +126,14 @@
GValue *value,
GParamSpec *pspec)
{
+ GdmGreeterPanel *self;
+
+ self = GDM_GREETER_PANEL (object);
+
switch (prop_id) {
+ case PROP_MONITOR:
+ g_value_set_int (value, self->priv->monitor);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -419,6 +451,16 @@
G_TYPE_NONE,
1, G_TYPE_STRING);
+ g_object_class_install_property (object_class,
+ PROP_MONITOR,
+ g_param_spec_int ("monitor",
+ "Xinerama monitor",
+ "The monitor (in terms of Xinerama) which the window is on",
+ 0,
+ G_MAXINT,
+ 0,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
g_type_class_add_private (klass, sizeof (GdmGreeterPanelPrivate));
}
@@ -453,8 +495,8 @@
return;
}
- g_debug ("GdmGreeterPanel: activating selected layout %s", layout);
- gdm_layout_activate (layout);
+ g_debug ("GdmGreeterPanel: activating selected layout %s", layout);
+ gdm_layout_activate (layout);
g_signal_emit (panel, signals[LAYOUT_SELECTED], 0, layout);
@@ -582,11 +624,14 @@
}
GtkWidget *
-gdm_greeter_panel_new (void)
+gdm_greeter_panel_new (GdkScreen *screen,
+ int monitor)
{
GObject *object;
object = g_object_new (GDM_TYPE_GREETER_PANEL,
+ "screen", screen,
+ "monitor", monitor,
NULL);
return GTK_WIDGET (object);
@@ -607,8 +652,8 @@
gtk_widget_hide (panel->priv->language_option_widget);
gtk_widget_hide (panel->priv->layout_option_widget);
- g_debug ("GdmGreeterPanel: activating default layout");
- gdm_layout_activate (NULL);
+ g_debug ("GdmGreeterPanel: activating default layout");
+ gdm_layout_activate (NULL);
}
void
@@ -664,8 +709,8 @@
gdm_option_widget_set_default_item (GDM_OPTION_WIDGET (panel->priv->layout_option_widget),
layout_name);
- g_debug ("GdmGreeterPanel: activating layout: %s", layout_name);
- gdm_layout_activate (layout_name);
+ g_debug ("GdmGreeterPanel: activating layout: %s", layout_name);
+ gdm_layout_activate (layout_name);
#endif
}
Modified: trunk/gui/simple-greeter/gdm-greeter-panel.h
==============================================================================
--- trunk/gui/simple-greeter/gdm-greeter-panel.h (original)
+++ trunk/gui/simple-greeter/gdm-greeter-panel.h Wed Aug 20 20:44:50 2008
@@ -57,7 +57,8 @@
GType gdm_greeter_panel_get_type (void);
-GtkWidget * gdm_greeter_panel_new (void);
+GtkWidget * gdm_greeter_panel_new (GdkScreen *screen,
+ int monitor);
void gdm_greeter_panel_show_user_options (GdmGreeterPanel *panel);
void gdm_greeter_panel_hide_user_options (GdmGreeterPanel *panel);
Modified: trunk/gui/simple-greeter/gdm-greeter-session.c
==============================================================================
--- trunk/gui/simple-greeter/gdm-greeter-session.c (original)
+++ trunk/gui/simple-greeter/gdm-greeter-session.c Wed Aug 20 20:44:50 2008
@@ -126,7 +126,7 @@
{
g_debug ("GdmGreeterSession: default layout name changed: %s", text);
gdm_greeter_panel_set_default_layout_name (GDM_GREETER_PANEL (session->priv->panel),
- text);
+ text);
}
static void
@@ -274,7 +274,16 @@
gdm_profile_start (NULL);
if (enabled) {
- session->priv->panel = gdm_greeter_panel_new ();
+ GdkDisplay *display;
+ GdkScreen *screen;
+ int monitor;
+ int x, y;
+
+ display = gdk_display_get_default ();
+ gdk_display_get_pointer (display, &screen, &x, &y, NULL);
+ monitor = gdk_screen_get_monitor_at_point (screen, x, y);
+
+ session->priv->panel = gdm_greeter_panel_new (screen, monitor);
g_signal_connect_swapped (session->priv->panel,
"language-selected",
Modified: trunk/gui/simple-greeter/test-greeter-panel.c
==============================================================================
--- trunk/gui/simple-greeter/test-greeter-panel.c (original)
+++ trunk/gui/simple-greeter/test-greeter-panel.c Wed Aug 20 20:44:50 2008
@@ -35,7 +35,11 @@
int
main (int argc, char *argv[])
{
- GtkWidget *panel;
+ GtkWidget *panel;
+ GdkDisplay *display;
+ GdkScreen *screen;
+ int monitor;
+ int x, y;
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
@@ -45,7 +49,11 @@
gtk_init (&argc, &argv);
- panel = gdm_greeter_panel_new ();
+ display = gdk_display_get_default ();
+ gdk_display_get_pointer (display, &screen, &x, &y, NULL);
+ monitor = gdk_screen_get_monitor_at_point (screen, x, y);
+
+ panel = gdm_greeter_panel_new (screen, monitor);
gdm_greeter_panel_show_user_options (GDM_GREETER_PANEL (panel));
gtk_widget_show (panel);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]