GdkClientEvent How???

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

 



Hi

I am new here. 

Pleasse help me.
After reading GTK, GDK manuals/references I still have problem of
creating an event and receiving it in other frame/drawingarea.

OK. It is like that:
In foo.c file I have the common GTK code for creating window/drawing
area and then I set callback for any event coming. 

CODE

In file foo.c
	....
  drawingarea = gtk_drawing_area_new ();
  gtk_widget_show (drawingarea);
  gnome_app_set_contents (GNOME_APP (window), drawingarea);

  g_signal_connect_swapped ((gpointer) drawingarea, "event",
                            G_CALLBACK (on_drawingarea_event),
                            NULL);

	....

Then in callback I just would like to see what events the drawingarea
receive (just as example and to simplify code) 
As you can see in the following code I would like to receive 
GdkClientEvent <- which I would like to send from another part of code. 
Let assume I have five windows with drawingareas and all of them have to
react for GdkClientEvent

CODE:
In file foo_callbacks.c

gboolean
on_drawingarea_event(GtkWidget       *widget,
                            GdkEvent        *event,
                            gpointer         user_data)
{
  fprintf(stderr,"App: Drawing_Area event \n") ;
  if (event->type == GDK_CLIENT_EVENT) {
    fprintf(stderr,"A Client EVENT \n") ;
  } 
  else if (event->type == GDK_CONFIGURE) {
    fprintf(stderr,"Got request for resizing w: %d, h: %d\n",
	    area->allocation.width,
	    area->allocation.height) ;
  } 
  else if (event->type == GDK_EXPOSE) {
    fprintf(stderr,"Got request for expose \n") ;
  }
  else if (event->type == GDK_PROPERTY_NOTIFY) {
    fprintf(stderr,"Got request for property \n") ;
  }

   // for example just to show something
    gdk_draw_rectangle( area->window,  area->style->black_gc,
			TRUE, 0,0,
			area->allocation.width,
			area->allocation.height) ;

  return TRUE;
}


and NOW  - here in this file I would like to create event and put it in
a queue so all drawingareas will be notified - and refresh their content
for example

Here how I try to do that (after reading GDK reference)
in moo.c

gvoid
sendEventUpdated(Source *src) {
  GdkEventClient* event ;
  event = (GdkEventClient*)gdk_event_new(GDK_CLIENT_EVENT) ;
  event->type = GDK_CLIENT_EVENT ;
  event->window = NULL ;
  event->send_event = TRUE ;
  event->data_format = 32 ;
  event->message_type = GDK_POINTER_TO_ATOM("image_updated") ;
  event->data.l[0] = src->id ;
  event->data.l[1] = (long)src->image ;
  
  gdk_event_put((GdkEvent *)event);

  gdk_event_free((GdkEvent *)event);
}


BUT IT DOESNT WORK - I do not know why???
Also either I do not send event or drawing area doesnt receive events
(drawingarea and window was made with glade-2 - so I assume there are
the events masks set - expose event for example works)

Can anybody show me how I can create  GdkClientEvent event and send it
to any GTK window (for example with drawing areas :)) )
Or maybe there is some examples - however I couldnt find it in google
:((((


Zbych



_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux