Home Forums Wiki Doc Install Extras Screenshots Source Code Projects Blog Users Groups Register
Glx-Dock / Cairo-Dock List of forums Technical discussions | Discussions techniques Catch SIGINT (Ctrl+C)
The latest stable release is the *3.4.0* : How to install it here.
Note: We just switched from BZR to Git on Github! (only to host the code and your future pull requests)
Technical discussions | Discussions techniques

Subjects Author Language Messages Last message
[Locked] Catch SIGINT (Ctrl+C)
matttbe English 1 matttbe [Read]
07 April 2012 à 02:53

matttbe, Sunday 18 March 2012 à 16:06


Subscription date : 24 January 2009
Messages : 12573
Hello,

I think it can be interesting to catch the SIGINT signal in order to easily and quickly test modifications or for debugging purposes.
But if we catch this SIGINT signal, we first display a message to say that the dock is trying to quit properly but if there is a problem, the user can send a SIGQUIT signal (Ctrl+\).
=== modified file 'src/cairo-dock.c'
--- src/cairo-dock.c    2012-03-07 00:32:00 +0000
+++ src/cairo-dock.c    2012-03-18 14:57:14 +0000
@@ -199,+166,13 @@
 {
     
gtk_main_quit ();
 }
+static 
void _cairo_dock_quit_with_message (int signal)
+{
+    
g_print ("SIGINT detected (sig %d)\n"
+        "The dock is trying to quit properly.\n"
+        "If you have any problem, you can send a SIGQUIT signal simply by using this shortkey: Ctrl + \\\n"signal);
+    
_cairo_dock_quit (signal);
+}
 static 
void _cairo_dock_intercept_signal (int signal)
 {
     
cd_warning ("Cairo-Dock has crashed (sig %d).\nIt will be restarted now.\nFeel free to report this bug on glx-dock.org to help improving the dock!"signal);
@@ -
199,+210,@@
     
signal (SIGSEGV_cairo_dock_intercept_signal);  // Segmentation violation
     
signal (SIGFPE_cairo_dock_intercept_signal);  // Floating-point exception
     
signal (SIGILL_cairo_dock_intercept_signal);  // Illegal instruction
-    signal (SIGABRT_cairo_dock_intercept_signal);  // Abort
-    signal (SIGTERM_cairo_dock_quit);  // Abort
+    signal (SIGABRT_cairo_dock_intercept_signal);  // Abort // kill -6
+    signal (SIGTERM_cairo_dock_quit);  // Abort // kill -15 (system)
+    signal (SIGINT_cairo_dock_quit_with_message);   // Abort // kill -2 or Ctrl+C
 
}
 
 static 
gboolean on_delete_maintenance_gui (GtkWidget *pWidgetGdkEvent *eventGMainLoop *pBlockingLoop)
@@ -
836,+867,@@
     
signal (SIGILLNULL);  // Illegal instruction
     
signal (SIGABRTNULL);
     
signal (SIGTERMNULL);
+    
signal (SIGINTNULL);
+
     
gldi_free_all ();
     
     
rsvg_term ();



matttbe, Saturday 07 April 2012 à 02:53


Subscription date : 24 January 2009
Messages : 12573
If it's not possible to use SIGINT to properly quit the dock, another possibility is to use SIGQUIT (Ctrl+\)
=== modified file 'src/cairo-dock.c'
--- src/cairo-dock.c    2012-04-07 00:48:14 +0000
+++ src/cairo-dock.c    2012-04-07 00:48:29 +0000
@@ -161,+161,13 @@
 {
     
gtk_main_quit ();
 }
+static 
void _cairo_dock_quit_with_message (int signal)
+{
+    
g_print ("SIGQUIT detected (sig %d):\n"
+        " The dock is trying to quit properly.\n"
+        " If you have any problem, you can send a SIGINT signal simply by using this shortkey: Ctrl + C\n\n"signal);
+    
_cairo_dock_quit (signal);
+}
 static 
void _cairo_dock_intercept_signal (int signal)
 {
     
cd_warning ("Cairo-Dock has crashed (sig %d).\nIt will be restarted now.\nFeel free to report this bug on glx-dock.org to help improving the dock!"signal);
@@ -
201,+208,@@
     
signal (SIGILL_cairo_dock_intercept_signal);  // Illegal instruction
     
signal (SIGABRT_cairo_dock_intercept_signal);  // Abort // kill -6
     
signal (SIGTERM_cairo_dock_quit);  // Term // kill -15 (system)
+    signal (SIGQUIT_cairo_dock_quit_with_message);   // Quit // kill -2 or 'Ctrl+\'
 
}
 
 static 
gboolean on_delete_maintenance_gui (GtkWidget *pWidgetGdkEvent *eventGMainLoop *pBlockingLoop)
@@ -
837,+845,@@
     
signal (SIGILLNULL);  // Illegal instruction
     
signal (SIGABRTNULL);
     
signal (SIGTERMNULL);
+    
signal (SIGQUITNULL);
+
     
gldi_free_all ();
     
     
rsvg_term ();



It's only useful for dev and testers but it's a interesting way to quickly and properly quit the dock. The other solution is to use the menu or another terminal to quit and relauch the dock (we can use 'Reboot' DBus command)

Technical discussions | Discussions techniques

Subjects Author Language Messages Last message
[Locked] Catch SIGINT (Ctrl+C)
matttbe English 1 matttbe [Read]
07 April 2012 à 02:53


Glx-Dock / Cairo-Dock List of forums Technical discussions | Discussions techniques Catch SIGINT (Ctrl+C) Top

Online users :

Powered by ElementSpeak © 2007 Adrien Pilleboue, 2009-2013 Matthieu Baerts.
Dock based on CSS Dock Menu (Ndesign) with jQuery. Icons by zgegball
Cairo-Dock is a free software under GNU-GPL3 licence. First stable version created by Fabounet.
Many thanks to TuxFamily for the web Hosting and Mav for the domain name.