[Pkg-wmaker-commits] [wmsystemtray] 13/34: Use SIGUSR1/2 for paging

Doug Torrance dtorrance-guest at moszumanska.debian.org
Mon Aug 24 04:01:12 UTC 2015


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to branch master
in repository wmsystemtray.

commit d2726eb518360b93cfbd104e096874827d2f42eb
Author: Brad Jorsch <anomie at users.sourceforge.net>
Date:   Sat Feb 22 21:14:01 2014 -0500

    Use SIGUSR1/2 for paging
---
 ChangeLog         |  7 +++++++
 fdtray.c          |  2 +-
 wmsystemtray.1.in |  3 +++
 wmsystemtray.c    | 24 +++++++++++++-----------
 4 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2f6de21..dedb6f0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+wmsystemtray (1.4) unstable; urgency=low
+
+  * Remove testing code for unimplemented balloon messages.
+  * Use SIGUSR1 and SIGUSR2 for paging.
+
+ -- Brad Jorsch <anomie at users.sourceforge.net>  Sat, 22 Feb 2014 21:11:17 -0500
+
 wmsystemtray (1.3) unstable; urgency=medium
 
   * Remove debian directory, I see someone has officially packaged it (:
diff --git a/fdtray.c b/fdtray.c
index 3898a29..f829e7f 100644
--- a/fdtray.c
+++ b/fdtray.c
@@ -224,7 +224,7 @@ struct trayfuncs *fdtray_init(int id, int argc, char **argv){
 
     // Try to grab the system tray selection. ICCCM specifies that we first
     // check for an existing owner, then grab it with a non-CurrentTime
-    // timestamp, then check again if we now own int.
+    // timestamp, then check again if we now own it.
     if(XGetSelectionOwner(display, net_system_tray_s)){
         warn(DEBUG_WARN, "Another application is already running as the freedesktop.org protocol system tray");
         return NULL;
diff --git a/wmsystemtray.1.in b/wmsystemtray.1.in
index bdc5565..d9f350a 100644
--- a/wmsystemtray.1.in
+++ b/wmsystemtray.1.in
@@ -88,6 +88,9 @@ the current "page" of icons and total number of pages currently available.
 
 In addition to left-clicking either scrolling arrows, the mouse's scroll wheel
 may be used on the bottom section to change pages.
+.SH SIGNALS
+SIGUSR1 and SIGUSR2 may be used to change pages. A program such as xbindkeys
+may be used to send these signals to wmsystemtray on appropriate key presses.
 .SH BUGS
 The balloon message portion of the freedesktop.org protocol is not implemented
 at this time. I've heard that the official Gnome system tray doesn't implement
diff --git a/wmsystemtray.c b/wmsystemtray.c
index 87cbf75..ece875f 100644
--- a/wmsystemtray.c
+++ b/wmsystemtray.c
@@ -37,7 +37,7 @@
 
 /* Global variables */
 volatile sig_atomic_t exitapp=False;
-volatile sig_atomic_t testmessage=False;
+volatile sig_atomic_t sigusr=0;
 
 const char *PROGNAME=NULL;
 Bool nonwmaker=False;
@@ -55,7 +55,6 @@ static Bool point_messages=False;
 static int fill_style=0;
 static int arrow_style=0;
 //static Bool no_messages=False;
-static int testmessagecount=0;
 
 Display *display=NULL;
 int screen=0;
@@ -241,9 +240,10 @@ static void sighandler(int i){
         // Reload something?
         break;
       case SIGUSR1:
-        testmessage=True;
+        sigusr--;
         break;
       case SIGUSR2:
+        sigusr++;
         break;
     }
     signal(i,sighandler);
@@ -721,6 +721,16 @@ int main(int argc, char *argv[]){
     fd_set rfds;
     warn(DEBUG_DEBUG, "Entering main loop");
     while(!exitapp){
+        if (sigusr) {
+            warn(DEBUG_INFO, "Handling SIGUSR1/SIGUSR2, delta = %d", sigusr);
+            int pages = (num_mapped_icons-1)/icons_per_row/icons_per_col/num_windows + 1;
+            current_page += sigusr;
+            sigusr = 0;
+            while(current_page < 0) current_page += pages;
+            while(current_page >= pages) current_page -= pages;
+            need_update=True;
+        }
+
         while(XPending(display)){
             struct trayicon *icon = NULL;
             XNextEvent(display, &ev);
@@ -842,14 +852,6 @@ int main(int argc, char *argv[]){
         if(exitapp) break;
         warn(DEBUG_DEBUG, "Need update? %s", need_update?"Yes":"No");
         if(need_update) update();
-        if(testmessage){
-            testmessage=False;
-            if(!icon_begin_message(iconwin[0],++testmessagecount,12,1000)){
-                warn(DEBUG_ERROR,"Could not begin test message");
-            } else if(!icon_message_data(iconwin[0],testmessagecount,"Test message",12)){
-                warn(DEBUG_ERROR,"Could not send test message data");
-            }
-        }
 
         if(XPending(display)) continue;
         fd=ConnectionNumber(display);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmsystemtray.git



More information about the Pkg-wmaker-commits mailing list