From 8a9dbc6c7f3281100daba2de235c5c409121e5f4 Mon Sep 17 00:00:00 2001 From: Dmitry Kalyanov Date: Thu, 19 Mar 2009 00:54:01 +0300 Subject: [PATCH] add gtk main-loop-events --- gtk/gtk.asd | 2 ++ gtk/gtk.demo.lisp | 1 + gtk/gtk.dialog.example.lisp | 2 +- gtk/gtk.main-loop-events.lisp | 62 +++++++++++++++++++++++++++++++++++++++++ gtk/gtk.menu.lisp | 2 +- gtk/gtk.misc.lisp | 2 -- 6 files changed, 67 insertions(+), 4 deletions(-) create mode 100644 gtk/gtk.main-loop-events.lisp diff --git a/gtk/gtk.asd b/gtk/gtk.asd index 68fe66f..3661f03 100644 --- a/gtk/gtk.asd +++ b/gtk/gtk.asd @@ -43,6 +43,8 @@ (:file "gtk.child-properties") (:file "gtk.widget") (:file "gtk.builder") + + (:file "gtk.main-loop-events") (:file "gtk.generated-child-properties") diff --git a/gtk/gtk.demo.lisp b/gtk/gtk.demo.lisp index 978a3d1..68e0a54 100644 --- a/gtk/gtk.demo.lisp +++ b/gtk/gtk.demo.lisp @@ -492,6 +492,7 @@ (c 0)) (builder-connect-signals-simple builder `(("toolbutton1_clicked_cb" ,(lambda (b) (declare (ignore b)) + #+nil(print (current-event)) (setf (text-buffer-text (text-view-buffer text-view)) (format nil "Clicked ~A times~%" (incf c))) (status-bar-pop (builder-get-object builder "statusbar1") diff --git a/gtk/gtk.dialog.example.lisp b/gtk/gtk.dialog.example.lisp index e9647e3..8432480 100644 --- a/gtk/gtk.dialog.example.lisp +++ b/gtk/gtk.dialog.example.lisp @@ -28,5 +28,5 @@ (format t "Response was: ~S~%" (dialog-run dialog)) (object-destroy dialog))))) - (gtk-widget-show-all window) + (widget-show window) (gtk-main))) \ No newline at end of file diff --git a/gtk/gtk.main-loop-events.lisp b/gtk/gtk.main-loop-events.lisp new file mode 100644 index 0000000..c882fee --- /dev/null +++ b/gtk/gtk.main-loop-events.lisp @@ -0,0 +1,62 @@ +(in-package :gtk) + +; TODO: gtk_get_default_language + +(defcfun gtk-main-iteration :boolean) + +(export 'gtk-main-iteration) + +(defcfun gtk-main-iteration-do :boolean + (blocking :boolean)) + +(export 'gtk-main-iteration-do) + +; TODO: gtk_main_do_event + +(defcfun (grad-add "gtk_grab_add") :void + (widget g-object)) + +(export 'grab-add) + +(defcfun (grab-current "gtk_grab_get_current") g-object) + +(export 'grab-current) + +(defcfun (grab-remove "gtk_grab_remove") :void + (widget g-object)) + +(export 'grab-remove) + +; TODO: gtk_quit_add_destroy + +; TODO: gtk_quit_add + +; TODO: gtk_quit_add_full + +; TODO: gtk_quit_remove + +; TODO: gtk_quit_remove_by_data + +; TODO: gtk_key_snooper_install + +; TODO: gtk_key_snooper_remove + +(defcfun (current-event "gtk_get_current_event") (g-boxed-ptr event)) + +(export 'current-event) + +(defcfun (current-event-time gtk-get-current-event-time) :uint32) + +(export 'current-event-time) + +(defcfun (event-widget "gtk_get_event_widget") g-object + (event (g-boxed-ptr event))) + +(export 'event-widget) + +(defcfun (propagate-event "gtk_propagate_event") :void + (widget g-object) + (event (g-boxed-ptr event))) + +(export 'propagate-event) + diff --git a/gtk/gtk.menu.lisp b/gtk/gtk.menu.lisp index 5c3df95..4a8ba7e 100644 --- a/gtk/gtk.menu.lisp +++ b/gtk/gtk.menu.lisp @@ -38,7 +38,7 @@ (mem-ref y :int) 0 (mem-ref push-in :boolean) nil)))) -(defun menu-popup (menu &key parent-menu-shell parent-menu-item position-func (button 0) (activate-time (gtk-get-current-event-time))) +(defun menu-popup (menu &key parent-menu-shell parent-menu-item position-func (button 0) (activate-time (current-event-time))) (if position-func (with-stable-pointer (ptr position-func) (gtk-menu-popup menu parent-menu-shell parent-menu-item diff --git a/gtk/gtk.misc.lisp b/gtk/gtk.misc.lisp index 8d7bdf2..f20f586 100644 --- a/gtk/gtk.misc.lisp +++ b/gtk/gtk.misc.lisp @@ -2,5 +2,3 @@ (defcallback stable-pointer-free-destroy-notify-callback :void ((data :pointer)) (free-stable-pointer data)) - -(defcfun gtk-get-current-event-time :uint32) \ No newline at end of file -- 1.7.10.4