aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main-window.vala51
-rw-r--r--src/settings.vala1
2 files changed, 32 insertions, 20 deletions
diff --git a/src/main-window.vala b/src/main-window.vala
index 3240bc1..df530e0 100644
--- a/src/main-window.vala
+++ b/src/main-window.vala
@@ -27,6 +27,8 @@ public class MainWindow : Gtk.Window
private List<Monitor> monitors;
private Monitor? primary_monitor;
private Monitor active_monitor;
+ private string only_on_monitor;
+ private bool monitor_setting_ok;
private Background background;
private Gtk.Box login_box;
private Gtk.Box hbox;
@@ -154,6 +156,9 @@ public class MainWindow : Gtk.Window
window_size_y = 0;
primary_monitor = null;
+ only_on_monitor = AGSettings.get_string(AGSettings.KEY_ONLY_ON_MONITOR);
+ monitor_setting_ok = only_on_monitor == "auto";
+
if (ArcticaGreeter.singleton.test_mode)
{
/* Simulate an 800x600 monitor to the left of a 640x480 monitor */
@@ -252,9 +257,13 @@ public class MainWindow : Gtk.Window
if (monitor_is_unique_position (display, i))
{
var greeter_monitor = new Monitor (geometry.x, geometry.y, geometry.width, geometry.height);
+ var plug_name = monitor.get_model();
monitors.append (greeter_monitor);
- if (primary_monitor == null || primary == monitor)
+ if (plug_name == only_on_monitor)
+ monitor_setting_ok = true;
+
+ if (plug_name == only_on_monitor || primary_monitor == null || primary == monitor)
primary_monitor = greeter_monitor;
}
}
@@ -291,30 +300,32 @@ public class MainWindow : Gtk.Window
public override bool motion_notify_event (Gdk.EventMotion event)
{
- var x = (int) (event.x + 0.5);
- var y = (int) (event.y + 0.5);
-
- /* Get motion event relative to this widget */
- if (event.window != get_window ())
+ if (!monitor_setting_ok || only_on_monitor == "auto")
{
- int w_x, w_y;
- get_window ().get_origin (out w_x, out w_y);
- x -= w_x;
- y -= w_y;
- event.window.get_origin (out w_x, out w_y);
- x += w_x;
- y += w_y;
- }
+ var x = (int) (event.x + 0.5);
+ var y = (int) (event.y + 0.5);
- foreach (var m in monitors)
- {
- if (x >= m.x && x <= m.x + m.width && y >= m.y && y <= m.y + m.height)
+ /* Get motion event relative to this widget */
+ if (event.window != get_window ())
{
- move_to_monitor (m);
- break;
+ int w_x, w_y;
+ get_window ().get_origin (out w_x, out w_y);
+ x -= w_x;
+ y -= w_y;
+ event.window.get_origin (out w_x, out w_y);
+ x += w_x;
+ y += w_y;
}
- }
+ foreach (var m in monitors)
+ {
+ if (x >= m.x && x <= m.x + m.width && y >= m.y && y <= m.y + m.height)
+ {
+ move_to_monitor (m);
+ break;
+ }
+ }
+ }
return false;
}
diff --git a/src/settings.vala b/src/settings.vala
index 0372721..701d5a1 100644
--- a/src/settings.vala
+++ b/src/settings.vala
@@ -44,6 +44,7 @@ public class AGSettings
public const string KEY_GROUP_FILTER = "group-filter";
public const string KEY_IDLE_TIMEOUT = "idle-timeout";
public const string KEY_ACTIVATE_NUMLOCK = "activate-numlock";
+ public const string KEY_ONLY_ON_MONITOR = "only-on-monitor";
public const string KEY_REMOTE_SERVICE_CONFIGURE_URI = "remote-service-configure-uri";
public const string KEY_TOGGLEBOX_FONT_FGCOLOR = "togglebox-font-fgcolor";
public const string KEY_TOGGLEBOX_BUTTON_BGCOLOR = "togglebox-button-bgcolor";