Re: Patch for GdkWindow::(get|set)_decorations
| From: | Alan Knowles | Date: | Tue, 23 Dec 2003 12:26:31 +0000 |
| Subject: | Re: Patch for GdkWindow::(get|set)_decorations | ||
| References: | 1 | Groups: | php.gtk.dev |
| Request: | Send a blank email to php-gtk-dev+get-595@lists.php.net to get a copy of this message | ||
Can you file it as a bug, I'm not sure if we will add it in, as the 'team' as such is focusing on GTK2/ZE2 now.
did you want to get cvs karma and commit this? ???
Regards
Alan
Timm Friebe wrote:
Hello, here's a patch against the sources from the 1.0.0 tarball to add the following two functions: int GdkWindow::get_decorations(void) void GdkWindow::set_decorations(int decorations) I could see from a grep that the constants needed (GDK_DECOR_*) are defined but the functions weren't. Inside get_decorations(), the call to gdk_window_get_decorations() is if'ed as this function isn't defined on my system (see below [1]), issuing the message '/usr/libexec/ld-elf.so.1: /usr/ports/x11-toolkits/php-gtk/work/php-gtk-1.0.0/modules/php_gtk.so: Undefined symbol "gdk_window_get_decorations"'. I'm not sure if #if is correct (is there a define in GTK-versions with it?). It seems though from a search on Google that this function exists in some versions, therefor I added this functionality. The function returns FALSE in case gdk_window_get_decorations doesn't exist (maybe there should be a warning?). For the manual: ---------------------------------------------------------------------- GdkWindow::set_decorations() tries to set the decorations of a window. The decorations argument is the logical OR of the fields in the GdkWMDecoration enumeration. If GDK_DECOR_ALL is included in the mask, the other bits indicate which decorations should be turned off. If GDK_DECOR_ALL is not included, then the other bits indicate which decorations should be turned on. These are hints originally defined by the Motif toolkit. The window manager can use them when determining how to decorate the window. The hint must be set before mapping the window.-- Can you help out? Need Consulting Services or Know of a Job? http://www.akbkhome.comGDK_DECOR_ALL all decorations should be applied. GDK_DECOR_BORDER a frame should be drawn around the window.GDK_DECOR_RESIZEH the frame should have resize handles.GDK_DECOR_TITLE a titlebar should be placed above the window. GDK_DECOR_MENU a button for opening a menu should be included.GDK_DECOR_MINIMIZE a minimize button should be included. GDK_DECOR_MAXIMIZE a maximize button should be included. Note: This function needs to be called prior to the window being shown but after it has been realized (a GdkWindow is associated with the GtkWindow). ---------------------------------------------------------------------- [1] System information: $ uname -a FreeBSD friebes.net 4.8-STABLE FreeBSD 4.8-STABLE #9: Thu Aug 721:39:07 CEST 2003 root@friebes.net:/usr/obj/usr/src/sys/GENERIC i386$ gtk12-config --version 1.2.10 $ grep -Hrn 'decor' /usr/X11R6/include/gtk12/*/usr/X11R6/include/gtk12/gdk/gdk.h:378:void gdk_window_set_decorations (GdkWindow *window, /usr/X11R6/include/gtk12/gdk/gdk.h:379: GdkWMDecoration decorations);/usr/X11R6/include/gtk12/gdk/gdktypes.h:670: * of gdk_window_set_decorations/gdk_window_set_functions Please include me in any replies, I'm not subscribed to php-gtk-dev. - Timm ------------------------------------------------------------------------ --- ext/gtk+/php_gtk+_types.c Fri Oct 10 19:03:07 2003 +++ /home/thekid/php_gtk+_types.c Sun Dec 21 17:39:49 2003 @@ -600,6 +600,29 @@ src_window, src_x, src_y, width, height); } +PHP_FUNCTION(gdk_window_set_decorations) +{ + GdkWMDecoration decorations; + NOT_STATIC_METHOD(); + + if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "i", &decorations)) + return; + + gdk_window_set_decorations(PHP_GDK_WINDOW_GET(this_ptr), decorations); +} + +PHP_FUNCTION(gdk_window_get_decorations) +{ + GdkWMDecoration decorations; + +#if gdk_window_get_decorations + gdk_window_get_decorations(PHP_GDK_WINDOW_GET(this_ptr), &decorations); + RETURN_LONG(decorations); +#else + RETURN_FALSE; +#endif +} + static function_entry php_gdk_window_functions[] = { {"GdkWindow", PHP_FN(no_direct_constructor), NULL}, {"gdkwindow", PHP_FN(no_direct_constructor), NULL}, @@ -613,6 +636,8 @@ {"property_delete", PHP_FN(gdk_window_property_delete), NULL}, {"set_icon", PHP_FN(gdk_window_set_icon), NULL}, {"copy_area", PHP_FN(gdk_window_copy_area), NULL}, + {"set_decorations", PHP_FN(gdk_window_set_decorations), NULL}, + {"get_decorations", PHP_FN(gdk_window_get_decorations), NULL}, {NULL, NULL, NULL} };