Re: GtkPlug for Windows

From: Date: Sat, 27 Jan 2007 19:01:49 +0000
Subject: Re: GtkPlug for Windows
References: 1  Groups: php.gtk.dev 
Request: Send a blank email to php-gtk-dev+get-3600@lists.php.net to get a copy of this message
Leaving aside the actual patch code (which is not correct), what is the utility of a separate gtk_plug_construct() function? The documentation states that "This function will generally only be used by classes deriving from GtkPlug." If, as you say, you create a new GtkPlug with a socket_id of 0, the documentation suggests "plugging into a GtkSocket by gtk_socket_add_id". -Andrei On Jan 25, 2007, at 7:51 AM, Elizabeth Smith wrote:
Morning, As of Gtk+ 2.8 gtkplug and gtksocket work on windows. I don't know if anyone has tested the current gtkplug constructor override but I found it didn't work (at least on windows). The attached diff adds the construct method (which is different from new and doesn't create and object). The diff also changes the original override to call gtk_plug_new. If you send new GtkPlug a socket_id of 0 you can later call GtkPlug->construct with a new socket_id. It would be nice if there was a way to mark something in the generator relevant for a specific library version - then php-gtk2 could build against 2.6, 2.8 and 2.10. Anyway, the attachment replaces the current gtkplug constructor override and adds the construct method, it also removes the win32 ignores - that part may need to be omitted until there's a way to mark items by gtk lib version or the requirement for php-gtk2 is raised from 2.6. Also I'm sending a couple demos to use with the new functions. (Thanks to Leon Pegg for writing them :) Thanks, Elizabeth Smith Index: gtk.overrides =================================================================== RCS file: /repository/php-gtk/ext/gtk+/gtk.overrides,v retrieving revision 1.235 diff -u -r1.235 gtk.overrides --- gtk.overrides 23 Jan 2007 18:26:08 -0000 1.235 +++ gtk.overrides 25 Jan 2007 15:47:05 -0000 @@ -234,10 +234,6 @@ ignore
     GtkArgFlags
     GtkPrivateFlags
-%% -ignore-win32
-    GtkPlug
-    GtkSocket
%% }}} %% {{{ constants @@ -4119,6 +4115,38 @@ {
     gulong socket_id;
     zval *display = NULL;
+    GtkWidget *wrapped_obj = NULL;
+
+    if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "i|O", &socket_id, &display))
+        PHPG_THROW_CONSTRUCT_EXCEPTION(GtkPlug);
+
+    if (display) {
+        wrapped_obj = gtk_plug_new_for_display(GDK_DISPLAY(PHPG_GOBJECT(display)), socket_id);
+    } else {
+        wrapped_obj = gtk_plug_new(socket_id);
+    }
+
+    if (!wrapped_obj) {
+        PHPG_THROW_CONSTRUCT_EXCEPTION(GtkPlug);
+    }
+
+    phpg_gobject_new(&this_ptr, (GObject *) wrapped_obj TSRMLS_CC);
+} + +%% +add-arginfo GtkPlug construct +static +ZEND_BEGIN_ARG_INFO_EX(ARGINFO_NAME, 0, 0, 1)
+    ZEND_ARG_INFO(0, socket_id)
+    ZEND_ARG_OBJ_INFO(0, display, GdkDisplay, 1)
+ZEND_END_ARG_INFO(); + +%% +add GtkPlug construct +PHP_METHOD +{
+    gulong socket_id;
+    zval *display = NULL;
     GObject *wrapped_obj = NULL;
     if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "i|O", &socket_id, &display))
@@ -4136,8 +4164,9 @@
     if (!wrapped_obj) {
         PHPG_THROW_CONSTRUCT_EXCEPTION(GtkPlug);
     }
-}
+    phpg_gobject_new(&this_ptr, (GObject *) wrapped_obj TSRMLS_CC);
+} %% }}} %% {{{ GtkPixmap --PHP-GTK Development Mailing List (http://gtk.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.gtk.dev (#3600) next »