RE: [PHP-GTK-DEV] create cursor
| From: | Steph | Date: | Tue, 03 Aug 2004 16:15:38 +0000 |
| Subject: | RE: [PHP-GTK-DEV] create cursor | ||
| References: | 1 | Groups: | php.gtk.dev |
| Request: | Send a blank email to php-gtk-dev+get-663@lists.php.net to get a copy of this message | ||
It shouldn't have a pixmap as a second parameter - that looks like an
original GTK+ bug to me. Don't have the time to make a new build and check
right now, but if anyone does, all you'd need to do is alter gdk.defs so it
reads GdkBitmap for the second parameter of cursor_new_from_pixmap and
rebuild (for test purposes - actual fix should be added to overrides).
Anyone?
> -----Original Message-----
> From: Christian Weiske [mailto:cweiske@cweiske.de]
> Sent: 03 August 2004 16:12
> To: PHP-GTK Dev list
> Subject: [PHP-GTK-DEV] create cursor
>
>
> Hi
>
>
> Today I tried to create my own cursor....
>
> The Gdk::cursor_new_from_pixmap requires two pixmaps, but the pixmaps
> may have only 2 colors, so it could be a bitmap (but that's gtk
> specific). Now I tried it, and the application crashes.
>
> In the gtk manual they created the cursor with the help of
> gdk_bitmap_create_from_data, but that's missing in php-gtk.
>
> Am I'm right assuming that the create_cursor won't work?
>
> ======================
> <?php
> if( !extension_loaded('gtk')) {
> dl( 'php_gtk.' . PHP_SHLIB_SUFFIX);
> }
>
> $window = &new GtkWindow();
> $window->set_default_size(300, 300);
> $window->connect_object('destroy', array('gtk', 'main_quit'));
>
> transparent = &new GdkColor(0, 0, 0);
>
> $cursor = array(
> "5 5 2 1",
> "0 m white",
> "1 m black",
> "11111",
> "10000",
> "10000",
> "10000",
> "10000"
> );
> $cursormask = array(
> "5 5 2 1",
> "0 m white",
> "1 m black",
> "11111",
> "10000",
> "10000",
> "10000",
> "10000"
> );
>
> $window->realize();
> list($pixmap, $mask) = Gdk::pixmap_create_from_xpm_d($window->window,
> $transparent, $cursor);
> list($pixmask, $mask) = Gdk::pixmap_create_from_xpm_d($window->window,
> $transparent, $cursor);
>
> $style = &new GtkStyle();
> $cursor = Gdk::cursor_new_from_pixmap( $pixmap, $pixmask, $style->white,
> $style->black, 1, 1);
>
> //$pixmapwid = &new GtkPixmap($pixmap, $mask);
>
> //$window->add( $pixmapwid);
> $window->show_all();
> gtk::main();
> ?>
> ======================
>
>
> Regards/MfG,
> Christian Weiske
> --
> XMMS is playing now:
> Christina Aguilera - Infatuation
>