[gromit: 6/13] Import of gromit history



commit 65375a8d17828727446689e306f27f615ab6af37
Author: Simon Budig <simon budig de>
Date:   Fri Feb 23 12:00:00 2001 +0100

    Import of gromit history

 AUTHORS         |    1 +
 ChangeLog       |    5 ++
 Makefile        |    3 +
 gromit.c        |    5 +--
 gromitconf      |    8 ++--
 propertywatch.c |  136 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 150 insertions(+), 8 deletions(-)
---
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..1d4cdd5
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1 @@
+Simon Budig  <simon gimp org>
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000..b5940b1
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,5 @@
+2000-12-27  Simon Budig  <simon gimp org>
+
+        * */* Put gromit into CVS
+
+
diff --git a/Makefile b/Makefile
index 4fe7115..0613232 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,7 @@
 all: gromit
 
+propertywatch: propertywatch.c
+	gcc -o propertywatch propertywatch.c `gtk-config --libs --cflags`
+
 gromit: gromit.c
 	gcc -o gromit gromit.c `gtk-config --libs --cflags`
diff --git a/gromit.c b/gromit.c
index eebd276..1e101f1 100644
--- a/gromit.c
+++ b/gromit.c
@@ -218,10 +218,7 @@ gromit_toggle_grab (GromitData *data)
 	 default:
 	    g_printerr ("Huh?\n");
       }
-
-      /*   Hier sollte noch das Fenster wieder in den Vordergrund
-       *   geschaltet werden...
-       */  
+      gdk_window_raise (data->win->window);
    }
 }
 
diff --git a/gromitconf b/gromitconf
index b1984b5..ec64028 100644
--- a/gromitconf
+++ b/gromitconf
@@ -19,8 +19,8 @@
 "Core Pointer"[2] = "grüner Marker";
 "Core Pointer"[3] = "Radierer";
 "Core Pointer"[3 SHIFT] = "Radierer" (size = 150);
-"Artpad Pen" = "roter Stift" (size = 15);
-"Artpad Pen"[SHIFT] = "blauer Stift";
-"Artpad Pen"[CONTROL] = "Radierer";
-"Artpad Eraser" = "Radierer";
+"Pen1" = "roter Stift" (size = 15);
+"Pen1"[SHIFT] = "blauer Stift";
+"Pen1"[CONTROL] = "Radierer";
+"Eraser" = "Radierer";
 
diff --git a/propertywatch.c b/propertywatch.c
new file mode 100644
index 0000000..d526cbd
--- /dev/null
+++ b/propertywatch.c
@@ -0,0 +1,136 @@
+/* gwmh.c - GNOME WM interaction helper functions
+ * Copyright (C) 1999 Tim Janik
+ *
+ * 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 Library General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * this code is heavily based on the original gnomepager_applet
+ * implementation of The Rasterman (Carsten Haitzler) <raster rasterman com>
+ */
+
+#include <gtk/gtk.h>
+#include <gdk/gdkx.h>
+
+#include <X11/Xmd.h>
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+
+
+static GdkWindow*
+gdk_window_ref_from_xid (Window xwin)
+{
+  GdkWindow *window;
+
+  /* the xid maybe invalid already, in that case we return NULL */
+  window = gdk_window_lookup (xwin);
+  if (!window)
+     window = gdk_window_foreign_new (xwin);
+  else
+    gdk_window_ref (window);
+
+  return window;
+}
+
+
+static GdkFilterReturn
+root_event_monitor (GdkXEvent *gdk_xevent,
+		    GdkEvent  *event,
+		    gpointer   gdk_root)
+{
+  XEvent *xevent = gdk_xevent;
+  
+  switch (xevent->type)
+    {
+#if 0
+      GwmhDeskInfoMask imask;
+#endif
+
+    case MapNotify:
+    case UnmapNotify:
+    case CirculateNotify:
+    case ReparentNotify:
+    case DestroyNotify:
+#if 0
+      if (!gwmh_gnome_wm_win)
+	gwmh_desk_queue_update (GWMH_DESK_INFO_CLIENT_LIST);
+      if (gwmh_gnome_wm_win == xevent->xdestroywindow.window)
+	{
+	  gwmh_need_reboot = TRUE;
+	  gwmh_desk_queue_update (GWMH_DESK_INFO_FORCE_EVERYTHING);
+	}
+#endif
+      break;
+    case PropertyNotify:
+      g_printerr ("PropertyNotify %s\n", gdk_atom_name (xevent->xproperty.atom));
+#if 0
+      imask = gwmh_property_atom2info (xevent->xproperty.atom, FALSE);
+      if (imask)
+	gwmh_desk_queue_update (imask);
+      if (xevent->xproperty.atom == GWMHA_WIN_SUPPORTING_WM_CHECK)
+        {
+	  gwmh_need_reboot = TRUE;
+	  gwmh_desk_queue_update (GWMH_DESK_INFO_FORCE_EVERYTHING);
+	}
+#endif
+      break;
+    default:
+      break;
+    }
+  
+  return GDK_FILTER_CONTINUE;
+}
+
+gboolean
+init_monitor (void)
+{
+  static volatile guint n_init_calls = 0;
+  XWindowAttributes attribs = { 0, };
+  guint32 *property_data;
+  gint size = 0;
+  guint i;
+  GdkWindow *window;
+
+  window = gdk_window_ref_from_xid (GDK_ROOT_WINDOW ());
+  if (!window)
+    g_error (G_GNUC_PRETTY_FUNCTION "(): root window id %ld invalid? bad bad...",
+	     GDK_ROOT_WINDOW ());
+  gdk_window_add_filter (window,
+			 root_event_monitor,
+			 window);
+
+  gdk_error_trap_push ();
+
+  /* set event mask for events on root window */
+  XGetWindowAttributes (GDK_DISPLAY (),
+			GDK_ROOT_WINDOW (),
+			&attribs);
+  XSelectInput (GDK_DISPLAY (),
+		GDK_ROOT_WINDOW (),
+		attribs.your_event_mask |
+		// StructureNotifyMask |
+		PropertyChangeMask);
+  gdk_flush ();
+  
+  gdk_error_trap_pop ();
+
+}
+
+gint
+main (gint argc, gchar *argv[])
+{
+  gtk_init (&argc, &argv);
+  init_monitor ();
+  gtk_main ();
+}
+



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]