Re: [Fwd: gdk_event_get doesn't get GDK_EXPOSE]




Em Dom, 2003-12-14 ās 12:44, Russell Shaw escreveu:
> 
> Connect a callback to the "expose" event
> with g_signal_connect().

	Greetings,

	It didn't work here... It gave a warning
(expose_test1:712): GLib-GObject-WARNING **: gsignal.c:1893: signal
`expose' is invalid for instance `0x80591b8'

	Here is the test code. Any ideas ?

#include <stdio.h>
#include <glib.h>
#include <gdk/gdk.h>

void redraw (void);

int main (int argc, char *argv[])
{
  GdkWindow *test;
  GdkWindowAttr test_info;
  GdkEvent *events;
  gboolean exit_cond;
  
  gdk_init(&argc, &argv);
  
  test_info.title = "Expose test";
  test_info.event_mask = 0;
  test_info.width = 640;
  test_info.height = 480;
  test_info.window_type = GDK_WINDOW_TOPLEVEL;
  test_info.event_mask = GDK_EXPOSURE_MASK;
  
  test = gdk_window_new(NULL, &test_info, GDK_WA_TITLE );
  g_signal_connect (test, "expose", redraw, NULL); 
  gdk_window_show (test);
  
  do {
    do {
      events = gdk_event_get();
    } while (events == NULL);
    
    exit_cond = 
      (events->type == GDK_DELETE) ? TRUE :
      (events->type == GDK_DESTROY) ? TRUE :
      FALSE;
    
    gdk_event_free(events);
  } while (exit_cond == FALSE);
  
  gdk_window_destroy(test);
  
  return 0;
}

void redraw (void)
{
  printf ("expose ok.\n");
}


	Thank you,
	Henrique Dante de Almeida
	hdante terra com br





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