GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Thu Oct 30, 2014 12:15 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: gdk_window_invalidate_rect , gtk3
PostPosted: Wed Mar 28, 2012 9:05 pm 
Offline
Familiar Face

Joined: Tue Mar 27, 2012 10:50 pm
Posts: 7
gtk3

Question: how do I get the first argument for gdk_window_invalidate_rect from my GtkDrawingArea*widget in gtk3?


This is my "button-press" callback. Eventually clicking a button will make a change requiring redraw, which I'd like to handle in my "draw" signal callback. The manuals say I can trigger the draw signal by invalidating a region. The gdk_window_invalidate_rect says it's a wrapper around the region invalidator, and furthermore says I can pass NULL as second argument. The drawing is simple, redrawing the whole window will be quick.

Code:
/*the widget is a GtkDrawingArea*/
static gboolean button_press_event(GtkWidget*widget,const GdkEvent*event,gpointer data) {
  gdouble x_win, y_win;
  if (!gdk_event_get_coords(event,&x_win,&y_win))
    puts("BUTTON, gdk_event_get_coords(event,&x_win,&y_win)) failed");
  else
    printf("x_win=%g y_win=%g\n",(double)x_win,(double)y_win);
  gdk_window_invalidate_rect(widget,(const GdkRectangle *)NULL,TRUE);
  return TRUE;
}


Top
 Profile  
 
 Post subject: Re: gdk_window_invalidate_rect , gtk3
PostPosted: Wed Mar 28, 2012 10:05 pm 
Offline
Never Seen the Sunlight

Joined: Mon Apr 28, 2008 5:52 am
Posts: 766
Location: UK
Hi,

You will need to use the function :-
Code:
GdkWindow *         gtk_widget_get_window               (GtkWidget *widget);
to obtain the GdkWindow of a widget.

_________________
E.


Top
 Profile  
 
 Post subject: Re: gdk_window_invalidate_rect , gtk3
PostPosted: Wed Mar 28, 2012 10:51 pm 
Offline
Familiar Face

Joined: Tue Mar 27, 2012 10:50 pm
Posts: 7
Thank you for all your responses.

I hope to end up with a useful code with public posting at http://rosettacode.org/wiki/Honeycombs .
You can of course alter it or post before me. I suppose I'll finish tonight now that all the callbacks work. haha.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group