Added GPL license header to all source files
[dockapps/wmnotify.git] / src / xevents.c
index 4ff17df..976aaad 100644 (file)
@@ -1,6 +1,23 @@
-/* xevents.c -- handling X events, and detecting single-click and double-click
- *              mouse events. */
-
+/*
+ * xevents.c -- handling X events, and detecting single-click and double-click
+ *              mouse events.
+ *
+ * Copyright (C) 2009 Hugo Villeneuve <hugo@hugovil.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
 
 #if HAVE_CONFIG_H
 #  include "config.h"
@@ -66,13 +83,13 @@ ProcessXlibEventsInit( void (*single_click_callback)( void ),
 void
 ProcessXlibEvents( void )
 {
-  bool quit = FALSE;
-  bool button1_pressed = FALSE;
-  bool check_for_double_click = FALSE;
+  bool quit = false;
+  bool button1_pressed = false;
+  bool check_for_double_click = false;
   XEvent Event;
   
-  while( quit == FALSE ) {
-    if( ( check_for_double_click != FALSE ) &&
+  while( quit == false ) {
+    if( ( check_for_double_click != false ) &&
        ( XPending( dockapp.display ) == 0 ) ) {
       /* If no other button 1 events are received after the delay, then it is a
         single-click mouse event. */
@@ -80,7 +97,7 @@ ProcessXlibEvents( void )
        (*SingleClickCallback)();
       }
       
-      check_for_double_click = FALSE;
+      check_for_double_click = false;
     }
     /* XNextEvent is a blocking call: it will return only when an event is
        ready to be processed, thus freeing the CPU for other tasks when no
@@ -95,7 +112,7 @@ ProcessXlibEvents( void )
       /* Window was killed... */
       /* Is this necessary ? */
       (void) XCloseDisplay( dockapp.display );
-      quit = TRUE;
+      quit = true;
       break;
     case ClientMessage:
       /* Doesn't seem to work... */
@@ -104,24 +121,24 @@ ProcessXlibEvents( void )
     case ButtonPress:
       if( Event.xbutton.button == Button1 ) {
        /* Mouse LEFT button pressed. */
-       button1_pressed = TRUE;
+       button1_pressed = true;
       }
       break;
     case ButtonRelease:
       if( Event.xbutton.button == Button1 ) {
        /* Mouse LEFT button released. */
-       if( button1_pressed != FALSE ) {
+       if( button1_pressed != false ) {
          /* We act only when the button is released */
-         if( check_for_double_click != FALSE ) {
+         if( check_for_double_click != false ) {
            /* Double-click */
            if( DoubleClickCallback != NULL ) {
              (*DoubleClickCallback)();
            }
-           check_for_double_click = FALSE;
+           check_for_double_click = false;
          }
          else {
            (void) usleep( DOUBLE_CLICK_MAX_INTERVAL_MS * 1000 );
-           check_for_double_click = TRUE;
+           check_for_double_click = true;
          }
        }
       }