[Gd-chatter] r11423 - in branches/opendylan-melange: gtk gtk-duim

hannes at gwydiondylan.org hannes at gwydiondylan.org
Sat Jul 7 05:42:28 CEST 2007


Author: hannes
Date: Sat Jul  7 05:42:25 2007
New Revision: 11423

Modified:
   branches/opendylan-melange/gtk-duim/gtk-gadgets.dylan
   branches/opendylan-melange/gtk-duim/gtk-menus.dylan
   branches/opendylan-melange/gtk-duim/gtk-mirror.dylan
   branches/opendylan-melange/gtk/gtk.dylan
   branches/opendylan-melange/gtk/module.dylan
   branches/opendylan-melange/gtk/support.c
Log:
Job: fd

some more work on popup menus, still not working because
gtk assumes that gtk_menu_popup is called in the signal
handler for the button press, but duim wants to distribute
the signal to the thread of the window and call there
gtk_menu_popup... which pops up and is immediately hidden
with gtk_menu_popdown by someone.


Modified: branches/opendylan-melange/gtk-duim/gtk-gadgets.dylan
==============================================================================
--- branches/opendylan-melange/gtk-duim/gtk-gadgets.dylan	(original)
+++ branches/opendylan-melange/gtk-duim/gtk-gadgets.dylan	Sat Jul  7 05:42:25 2007
@@ -1218,6 +1218,7 @@
   elseif ((event.GdkEventButton-type == $GDK-BUTTON-PRESS) & (event.GdkEventButton-button == 3)) //right click
     gtk-debug("right clicked on list control!");
     when (gadget-popup-menu-callback(gadget))
+      gtk-set-button-time(event);
       distribute-popup-menu-callback(gadget, 0, x: round(event.GdkEventButton-x), y: round(event.GdkEventButton-y));
     end;
     #t

Modified: branches/opendylan-melange/gtk-duim/gtk-menus.dylan
==============================================================================
--- branches/opendylan-melange/gtk-duim/gtk-menus.dylan	(original)
+++ branches/opendylan-melange/gtk-duim/gtk-menus.dylan	Sat Jul  7 05:42:25 2007
@@ -457,16 +457,21 @@
      mirror :: <popup-menu-mirror>) => ()
   next-method();
   with-gdk-lock
-    gtk-widget-set-size-request(mirror.mirror-widget, 100, 100);
-    gtk-menu-popup(mirror.mirror-widget, null-pointer(<GtkWidget>), null-pointer(<GtkWidget>), null-pointer(<GtkMenuPositionFunc>),
-                   null-pointer(<GPointer>), 3, 0);
+    //with-disabled-event-handler (mirror.mirror-sheet.menu-owner.top-level-sheet.sheet-direct-mirror, #"expose-event")
+      popup-gtk-menu(mirror.mirror-widget, 3);
+    //end
+//    gtk-menu-popup(mirror.mirror-widget, null-pointer(<GtkWidget>), 
+//                   null-pointer(<GtkWidget>), null-pointer(<GtkMenuPositionFunc>),
+//                   null-pointer(<GPointer>), 3, 0);
+    //gtk-menu-shell-set-ignore-enter(mirror.mirror-widget, 0);
+    
   end
 end method map-mirror;
 
 define sealed method set-mirror-parent (menu :: <popup-menu-mirror>, widget :: <gtk-mirror>) => ()
   with-gdk-lock
-    gtk-menu-attach-to-widget(menu.mirror-widget, menu.mirror-sheet.menu-owner.top-level-sheet.sheet-direct-mirror.mirror-widget, null-pointer(<GtkMenuDetachFunc>));
-    gtk-menu-set-screen(menu.mirror-widget, null-pointer(<GdkScreen>));
+    //gtk-menu-attach-to-widget(menu.mirror-widget, menu.mirror-sheet.menu-owner.top-level-sheet.sheet-direct-mirror.mirror-widget, null-pointer(<GtkMenuDetachFunc>));
+    //gtk-menu-set-screen(menu.mirror-widget, null-pointer(<GdkScreen>));
   end
 end;
 

Modified: branches/opendylan-melange/gtk-duim/gtk-mirror.dylan
==============================================================================
--- branches/opendylan-melange/gtk-duim/gtk-mirror.dylan	(original)
+++ branches/opendylan-melange/gtk-duim/gtk-mirror.dylan	Sat Jul  7 05:42:25 2007
@@ -344,13 +344,17 @@
       ?body:*
     end }
  => { let signal-handler-id
-        = element(?mirror.signal-handler-ids, ?signal-name);
+        = element(?mirror.signal-handler-ids, ?signal-name, default: #f);
       let widget = mirror-widget(?mirror);
-      block()
-        g-signal-handler-block(widget, signal-handler-id);
-        ?body
-      cleanup
-        g-signal-handler-unblock(widget, signal-handler-id);
+      if (signal-handler-id)
+        block()
+          g-signal-handler-block(widget, signal-handler-id);
+          ?body
+        cleanup
+          g-signal-handler-unblock(widget, signal-handler-id);
+        end;
+      else
+        duim-debug-message("key %= not found in table %=", ?signal-name, ?mirror.signal-handler-ids.key-sequence);
       end; }
 end;
 

Modified: branches/opendylan-melange/gtk/gtk.dylan
==============================================================================
--- branches/opendylan-melange/gtk/gtk.dylan	(original)
+++ branches/opendylan-melange/gtk/gtk.dylan	Sat Jul  7 05:42:25 2007
@@ -50,6 +50,29 @@
   c-name: "gtk_dialog_get_action_area";
 end;
 
+define C-function gtk-menu-shell-set-ignore-enter
+  input parameter menu :: <GtkMenuShell>;
+  input parameter enabled? :: <gboolean>;
+  c-name: "gtk_menu_shell_set_ignore_enter";
+end;
+
+define C-function gdk-x11-get-server-time
+  input parameter window :: <GdkWindow>;
+  result time :: <guint32>;
+  c-name: "gdk_x11_get_server_time";
+end;
+
+define C-function popup-gtk-menu
+  input parameter menu :: <GtkMenu>;
+  input parameter button :: <guint>;
+  c-name: "popup_gtk_menu";
+end;
+
+define C-function gtk-set-button-time
+  input parameter event :: <GdkEventButton>;
+  c-name: "gtk_set_button_time";
+end;
+
 define C-subtype <_Fixed> (<_GtkFixed>) end;
 define constant <Fixed> = <_Fixed>;
 define C-function fixed-new

Modified: branches/opendylan-melange/gtk/module.dylan
==============================================================================
--- branches/opendylan-melange/gtk/module.dylan	(original)
+++ branches/opendylan-melange/gtk/module.dylan	Sat Jul  7 05:42:25 2007
@@ -18,6 +18,10 @@
     gtk-widget-get-allocation,
     gtk-dialog-get-vbox,
     gtk-dialog-get-action-area,
+    gtk-menu-shell-set-ignore-enter,
+    gdk-x11-get-server-time,
+    popup-gtk-menu,
+    gtk-set-button-time,
     g-value-nullify,
     g-value-to-dylan,
     g-value-set-value,

Modified: branches/opendylan-melange/gtk/support.c
==============================================================================
--- branches/opendylan-melange/gtk/support.c	(original)
+++ branches/opendylan-melange/gtk/support.c	Sat Jul  7 05:42:25 2007
@@ -3,6 +3,9 @@
 #include <gdk/gdkwindow.h>
 #include <gtk/gtkdialog.h>
 #include <gtk/gtkfixed.h>
+#include <gtk/gtkmenushell.h>
+#include <gtk/gtkmenu.h>
+#include <gdk/gdkx.h>
 
 typedef GtkFixed Fixed;
 typedef GtkFixedClass FixedClass;
@@ -91,5 +94,16 @@
       *foo = 0;
 }
 
+void gtk_menu_shell_set_ignore_enter (GtkMenuShell* menu, gboolean value) {
+  menu->ignore_enter = value ? TRUE : FALSE;
+}
 
-
+guint32 mytime = 0;
+void gtk_set_button_time (GdkEventButton *button) {
+  mytime = button->time;
+}
+  
+void popup_gtk_menu (GtkMenu* menu, guint button) {
+  g_print("%d mytime\n", mytime);
+  gtk_menu_popup(menu, NULL, NULL, NULL, NULL, button, mytime);
+}



More information about the chatter mailing list