aboutsummaryrefslogtreecommitdiff
path: root/src/arctica-greeter.vala
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2024-06-18 12:56:55 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2024-06-18 12:57:15 +0200
commit0bf37ddcf4ca9e79a426e02ff65ad3774f63e838 (patch)
treeddc84e153423e560d72a99ba4087e8220c8e0a27 /src/arctica-greeter.vala
parent6739f24a29891e1263fb83e4a2be7040ae900ae6 (diff)
downloadarctica-greeter-0bf37ddcf4ca9e79a426e02ff65ad3774f63e838.tar.gz
arctica-greeter-0bf37ddcf4ca9e79a426e02ff65ad3774f63e838.tar.bz2
arctica-greeter-0bf37ddcf4ca9e79a426e02ff65ad3774f63e838.zip
src/: Launch/stop real window manager event based.
Diffstat (limited to 'src/arctica-greeter.vala')
-rw-r--r--src/arctica-greeter.vala144
1 files changed, 77 insertions, 67 deletions
diff --git a/src/arctica-greeter.vala b/src/arctica-greeter.vala
index d6b6118..7a7a315 100644
--- a/src/arctica-greeter.vala
+++ b/src/arctica-greeter.vala
@@ -60,6 +60,7 @@ public class ArcticaGreeter : Object
public List<Pid> indicator_service_pids;
Pid notificationdaemon_pid = 0;
+ Pid windowmanager_pid = 0;
construct
{
@@ -833,7 +834,10 @@ public class ArcticaGreeter : Object
main_window = new MainWindow ();
- main_window.destroy.connect(() => { kill_fake_wm (); });
+ main_window.destroy.connect(() => {
+ stop_real_wm ();
+ kill_fake_wm ();
+ });
main_window.delete_event.connect(() =>
{
Gtk.main_quit();
@@ -876,6 +880,7 @@ public class ArcticaGreeter : Object
() => debug ("Failed to acquire name com.lomiri.Shell"));
}
+ start_real_wm ();
start_fake_wm ();
Gdk.threads_add_idle (ready_cb);
greeter_ready ();
@@ -1104,6 +1109,77 @@ public class ArcticaGreeter : Object
}
}
+ public void start_real_wm ()
+ {
+ string wm = AGSettings.get_string (AGSettings.KEY_WINDOW_MANAGER);
+ if ((wm == "metacity") || (wm == "marco"))
+ {
+ try
+ {
+ string[] argv;
+
+ Shell.parse_argv (wm, out argv);
+ Process.spawn_async (null,
+ argv,
+ null,
+ SpawnFlags.SEARCH_PATH,
+ null,
+ out windowmanager_pid);
+ debug ("Launched '%s' WM. PID: %d", wm, windowmanager_pid);
+ }
+ catch (Error e)
+ {
+ warning ("Error starting the '%s' Window Manager: %s", wm, e.message);
+ }
+
+ Timeout.add (50, () =>
+ {
+ try
+ {
+ string[] argv;
+ Pid wm_message_pid = 0;
+
+ Shell.parse_argv ("%s-message disable-keybindings".printf(wm), out argv);
+
+ Process.spawn_sync (null,
+ argv,
+ null,
+ SpawnFlags.SEARCH_PATH,
+ null,
+ null,
+ null,
+ null);
+ debug ("Launched '%s-message disable-keybindings' command", wm);
+ return false;
+ }
+ catch (Error e)
+ {
+ warning ("Error during '%s-message disable-keybindings' command call: %s", wm, e.message);
+ return true;
+ }
+ });
+ }
+ }
+
+ public void stop_real_wm ()
+ {
+ if (windowmanager_pid != 0)
+ {
+#if VALA_0_40
+ Posix.kill (windowmanager_pid, Posix.Signal.TERM);
+#else
+ Posix.kill (windowmanager_pid, Posix.SIGTERM);
+#endif
+ int status;
+ Posix.waitpid (windowmanager_pid, out status, 0);
+ if (Process.if_exited (status))
+ debug ("Window Manager exited with return value %d", Process.exit_status (status));
+ else
+ debug ("Window Manager terminated with signal %d", Process.term_sig (status));
+ windowmanager_pid = 0;
+ }
+ }
+
public static int main (string[] args)
{
/* Protect memory from being paged to disk, as we deal with passwords
@@ -1282,7 +1358,6 @@ public class ArcticaGreeter : Object
Pid atspi_pid = 0;
Pid nmapplet_pid = 0;
- Pid windowmanager_pid = 0;
if (!do_test_mode)
{
@@ -1426,55 +1501,6 @@ public class ArcticaGreeter : Object
activate_upower();
- string wm = AGSettings.get_string (AGSettings.KEY_WINDOW_MANAGER);
- if ((wm == "metacity") || (wm == "marco"))
- {
- try
- {
- string[] argv;
-
- Shell.parse_argv (wm, out argv);
- Process.spawn_async (null,
- argv,
- null,
- SpawnFlags.SEARCH_PATH,
- null,
- out windowmanager_pid);
- debug ("Launched '%s' WM. PID: %d", wm, windowmanager_pid);
- }
- catch (Error e)
- {
- warning ("Error starting the '%s' Window Manager: %s", wm, e.message);
- }
-
- Timeout.add (50, () =>
- {
- try
- {
- string[] argv;
- Pid wm_message_pid = 0;
-
- Shell.parse_argv ("%s-message disable-keybindings".printf(wm), out argv);
-
- Process.spawn_sync (null,
- argv,
- null,
- SpawnFlags.SEARCH_PATH,
- null,
- null,
- null,
- null);
- debug ("Launched '%s-message disable-keybindings' command", wm);
- return false;
- }
- catch (Error e)
- {
- warning ("Error during '%s-message disable-keybindings' command call: %s", wm, e.message);
- return true;
- }
- });
- }
-
greeter.greeter_ready.connect (() => {
debug ("Showing greeter");
greeter.show ();
@@ -1568,22 +1594,6 @@ public class ArcticaGreeter : Object
debug ("GeoClue-2.0 agent terminated with signal %d", Process.term_sig (status));
geoclueagent_pid = 0;
}
-
- if (windowmanager_pid != 0)
- {
-#if VALA_0_40
- Posix.kill (windowmanager_pid, Posix.Signal.TERM);
-#else
- Posix.kill (windowmanager_pid, Posix.SIGTERM);
-#endif
- int status;
- Posix.waitpid (windowmanager_pid, out status, 0);
- if (Process.if_exited (status))
- debug ("Window Manager exited with return value %d", Process.exit_status (status));
- else
- debug ("Window Manager terminated with signal %d", Process.term_sig (status));
- windowmanager_pid = 0;
- }
}
gsettings_mate_desktop_interface.set_int ("window-scaling-factor", wsf_orig);