Re: gdk_gc_predraw error



Its alive !!!!!
Better ...
The cursor dead in my window !!!!!!

There's in Gdk reference manual in the section gdk-cursor a example program that
make the cursor in a custom format, where they define bitmap to create the
bitmap I put 0x00 in all (void bitmap).

This is my code:

#define cursor1_width 16
#define cursor1_height 16
static unsigned char cursor1_bits[] = {
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static unsigned char cursor1mask_bits[] = {
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
  GdkCursor *cursor;
  GdkPixmap *source, *mask;
  GdkColor fg = { 0, 0, 0, 0 }; /* Transparent. */
  GdkColor bg = { 0, 0, 0, 0 }; /* Transparent. */   source =
gdk_bitmap_create_from_data (NULL, cursor1_bits,
cursor1_width, cursor1_height);
  mask = gdk_bitmap_create_from_data (NULL, cursor1mask_bits,
      cursor1_width, cursor1_height);
  cursor = gdk_cursor_new_from_pixmap (source, mask, &fg, &bg, 8, 8);
  gdk_pixmap_unref (source);
  gdk_pixmap_unref (mask);   gdk_window_set_cursor (widget->window, cursor);

When my application run, your window lost the cursor exactly that I want...

Sucess.

flaviothunder



Markus Fischer wrote:

> On Thu, Aug 23, 2001 at 09:21:13AM -0400, Flavio Alberto Lopes Soares wrote :
> > John Cupitt wrote:
> >
> > > yy wrote:
> > > > One is how to hide cursor? I don't want to show cursor.
> > >
> > > Hi yy, I guess you could make an empty cursor, and set that
> > > as the current. You need:
> > >
> > >         gdk_cursor_new_from_pixmap() gdk_window_set_cursor()
> >
> > I don't want to show cursor too, but I have problems with
> > gdk_window_set_cursor
> >
> > My code is:
> >
> > GdkCursor *cursor; .  .  .  cursor =
> > gdk_cursor_new_from_pixmap(NULL, NULL, NULL, NULL, NULL, NULL);
> > gdk_window_set_cursor(window_edit, cursor);
> >
> > but the compiler say: warning: passing arg 1 of
> > gdk_label_set_text from incompatible pointer type
> >
> > This is because window_edit was created from gtk_window_new(),
> > and I don't know make the window_edit compatible with gdk_
> > functions.
>
> A GtkWindow is derived from GtkWidget which provides ->window .
> ->window is always its associated GdkWindow (or its parent
> GdkWindow in some cases). Your widget needs to be realize'd so
> you can access its GdkWindow:
>
> window_edit = gtk_window_new();
> gtk_widget_realize(GTK_WIDGET(window_edit));
> [...]
>
> gdk_window_set_cursor(window_edit->window, ...
>
> - Markus





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]