com gtk/php-gtk: Adding GdkDevice::get_state(window) this allows us to track the location of the mouse pointers in the system, e.g. <?p hp $wnd = new GtkWindow(); $wnd->show (); $mouse = GdkDevice::get_core_pointe r(); $val = $mouse->get_state($wnd- >window); var_dump($val[0]); ?> : ext/gtk+/gdk.overrides
[email protected] (David Soria Parra)
| Newsgroups | php.gtk.cvs |
|---|---|
| Message-ID | <[email protected]> |
Commit: 598cc34d656f9470ccad8bc30998449264f29a81 Author: Christian Weiske <[email protected]> Sun, 11 Jun 2006 07:47:16 +0000 Parents: d06109acdd98d3dad8888e2bd5998525f50f101c Branches: master Link: http://git.php.net/?p=gtk/php-gtk.git;a=commitdiff;h=598cc34d656f9470ccad8bc30998449264f29a81 Log: Adding GdkDevice::get_state(window) this allows us to track the location of the mouse pointers in the system, e.g. <?php $wnd = new GtkWindow(); $wnd->show(); $mouse = GdkDevice::get_core_pointer(); $val = $mouse->get_state($wnd->window); var_dump($val[0]); ?> Changed paths: M ext/gtk+/gdk.overrides Diff: 598cc34d656f9470ccad8bc30998449264f29a81 diff --git a/ext/gtk+/gdk.overrides b/ext/gtk+/gdk.overrides index abebeaa..6479437 100644 --- a/ext/gtk+/gdk.overrides +++ b/ext/gtk+/gdk.overrides @@ -329,6 +329,54 @@ PHP_METHOD %% }}} +%% {{{ GdkDevice + +%% +add-arginfo GdkDevice get_state +static +ZEND_BEGIN_ARG_INFO(ARGINFO_NAME, 0) + ZEND_ARG_OBJ_INFO(0, window, GdkWindow, 0) +ZEND_END_ARG_INFO(); + +%% +override gdk_device_get_state +PHP_METHOD +{ + zval *php_window; + GdkDevice *device; + gdouble *axes; + GdkModifierType mask; + zval *php_axes = NULL, *value; + guint i; + + NOT_STATIC_METHOD(); + + if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "N", &php_window, gdkwindow_ce)) + return; + + device = GDK_DEVICE(PHPG_GOBJECT(this_ptr)); + + axes = g_new0(gdouble, device->num_axes); + + gdk_device_get_state( + device, + GDK_WINDOW(PHPG_GOBJECT(php_window)), + axes, &mask); + + MAKE_STD_ZVAL(php_axes); + array_init(php_axes); + for (i = 0; i < device->num_axes; i++) { + MAKE_STD_ZVAL(value); + ZVAL_DOUBLE(value, axes[i]); + add_next_index_zval(php_axes, value); + } + g_free(axes); + + php_gtk_build_value(&return_value, "(Ni)", php_axes, (int)mask); +} + +%% }}} + %% {{{ GdkDisplay %%