public inbox for guile-gtk@sourceware.org
 help / color / mirror / Atom feed
* gdk-window-get-events returns all-events-mask
@ 2003-03-03 23:07 Kevin Ryde
  2003-03-16  9:07 ` Daniel Skarda
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Ryde @ 2003-03-03 23:07 UTC (permalink / raw)
  To: guile-gtk

I think gdk-window-get-events sometimes returns '(all-events-mask) no
matter what the actual mask is.  For instance, on a recent i386 debian
with a recent cvs guile,

	(use-modules (gtk gtk)
	             (gtk gdk))

	(define wid (gtk-window-new 'toplevel))
	(gtk-widget-realize wid)

	(define win (gtk-widget-window wid))

	(gdk-window-set-events win '(enter-notify-mask))
	(display (gdk-window-get-events win))

prints '(all-events-mask), where I hoped for '(enter-notify-mask)
perhaps plus structure-mask or others added by the window manager.

It looks like sgtk_enum_flags_init ended up sorting "all-events-mask"
to the start of the literals array, then sgtk_flags2scm thinks it
matches "val & info->literals[i].value".

I think this might happen only sometimes, since if I'm right
sgtk_flags_comp sorts based on the SCM pointer for the symbol, which
will make the order somewhat arbitrary.


Clearly, returning all-events-mask when it's not "all" is incorrect.
But I'd think it'd be better not to return it at all, instead return
the individual bits, so they can be subtracted from or whatever.

Perhaps all-events-mask could be tagged for use only by scm2flags, not
flags2scm.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gdk-window-get-events returns all-events-mask
  2003-03-03 23:07 gdk-window-get-events returns all-events-mask Kevin Ryde
@ 2003-03-16  9:07 ` Daniel Skarda
  2003-03-16 21:57   ` Kevin Ryde
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Skarda @ 2003-03-16  9:07 UTC (permalink / raw)
  To: guile-gtk

Hello,

> It looks like sgtk_enum_flags_init ended up sorting "all-events-mask"
> to the start of the literals array, then sgtk_flags2scm thinks it
> matches "val & info->literals[i].value".

  thank you for your bugreport. I hope that

   if ((val & info->literals[i].value) == info->literals [i].value)

  solves your problem. 

> Perhaps all-events-mask could be tagged for use only by scm2flags, not
> flags2scm.

  Fortunately it is not necessary (after the bugfix). all-events-mask == 0xffff
and the last event substructure-mask == 1 << 20, so equality in above "if" is
not going to be problem anymore.

Have a nice day,
0.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gdk-window-get-events returns all-events-mask
  2003-03-16  9:07 ` Daniel Skarda
@ 2003-03-16 21:57   ` Kevin Ryde
  0 siblings, 0 replies; 3+ messages in thread
From: Kevin Ryde @ 2003-03-16 21:57 UTC (permalink / raw)
  To: guile-gtk

Daniel Skarda <0rfelyus@ucw.cz> writes:
>
>    if ((val & info->literals[i].value) == info->literals [i].value)

That should do the trick in practice, though I still think
all-events-mask shouldn't be returned at all.

>   Fortunately it is not necessary (after the bugfix). all-events-mask == 0xffff
> and the last event substructure-mask == 1 << 20, so equality in above "if" is
> not going to be problem anymore.

Actually, the absense of any event equal to "1 << 0" will ensure it
doesn't occurs.  But I think this is merely a bug in gtk,
GDK_ALL_EVENTS_MASK in gtk 2.2.1 has been corrected to 0x3FFFE
(there's a new 1<<21 bit added).

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-03-16 21:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-03 23:07 gdk-window-get-events returns all-events-mask Kevin Ryde
2003-03-16  9:07 ` Daniel Skarda
2003-03-16 21:57   ` Kevin Ryde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).