Help:Implement an widget derive from GtkLayout,puzzled in Handle expose event



Dear Sir:
    
     I'm porting some old gtk apps to 2.0 recently.It's somehow interesting
getting into the gtk 2.0 internal code.But now I have a problem:
     An widget derived from GtkLayout,as below
  struct MyWidget
   {
      GtkLayout layout;
      GdkPixmap  *back_pixmap;  file://backing store to avoid tingle when redraw
      ..
      ..
 
   }
   back_pixmap= gdk_pixmap_new(widget->window,...);
   MyWidget contain some child widget,text.
 
   in function hanle expose,first I use gdk_pixmap_new() to create a
   draw-backing buffer,and all the drawing is done on back_pixmap
   finally I invoke:
   gdk_draw_pixmap(layout->bin_window,gc,back_pixmap,x,y,x,y,width,height);
   to copy the drawing pixmap area to the actual layout->bin_window(the window on screen??),
   I assume that it will display back_pixmap on screen.
   If  the scrollbar positon is (0,0),no problem
   But I scroll the bar, it doesn't work,some area overlaped badly
 
   GtkLayout in 2.0 differernt from 1.2,it remove xoffset,yoffset,when scrolling
   it just call gdk_window_move(layout->bin_window,-hadjustment->value,-vadjustment->value);
                gdk_window_process_update(layout->bin_window,TRUE);
   in 1.2,it call gdk_window_move_resize(layout->bin_window,dx,0,widget->allocation.width-dx,widget->allocation.height);
             then gtk_layout_expose_area (layout,..) to send expose signal
  
   is the difference make the thing wrong? I wonder
 
   Dear gtk experts,can u help me?any hints is appreciated
 
Best wish
robbie
  
  
  
 
  


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