[dia] GSEAL: use gtk_widget_get_window instead of GtkWidget::window



commit a96d8136fc764c3a3b3fd7ec4be4be643a609d06
Author: Hans Breuer <hans breuer org>
Date:   Sun Mar 27 20:27:07 2011 +0200

    GSEAL: use gtk_widget_get_window instead of GtkWidget::window
    
    Small step towards resolving bug #643500

 app/color_area.c      |    8 ++++----
 app/create_object.c   |    2 +-
 app/cursor.c          |    2 +-
 app/defaults.c        |    4 ++--
 app/diacanvas.c       |   10 +++++-----
 app/diapagelayout.c   |    2 +-
 app/disp_callbacks.c  |    8 ++++----
 app/display.c         |   12 ++++++------
 app/linewidth_area.c  |    4 ++--
 app/magnify.c         |    8 ++++----
 app/modify_tool.c     |   16 ++++++++--------
 app/navigation.c      |   16 ++++++++--------
 lib/diaarrowchooser.c |    2 +-
 lib/dialinechooser.c  |    2 +-
 14 files changed, 48 insertions(+), 48 deletions(-)
---
diff --git a/app/color_area.c b/app/color_area.c
index 1e051b1..4db31ca 100644
--- a/app/color_area.c
+++ b/app/color_area.c
@@ -205,7 +205,7 @@ color_area_draw ()
   /*  draw the widget  */
   gdk_gc_set_clip_mask (color_area_gc, color_area_mask);
   gdk_gc_set_clip_origin (color_area_gc, 0, 0);
-  gdk_draw_drawable (color_area->window, color_area_gc, color_area_pixmap,
+  gdk_draw_drawable (gtk_widget_get_window(color_area), color_area_gc, color_area_pixmap,
 		   0, 0, 0, 0, width, height);
 
   /*  reset the clip mask  */
@@ -386,10 +386,10 @@ color_area_events (GtkWidget *widget,
 	  g_object_unref (color_area_mask);
 	}
 
-	color_area_pixmap = gdk_pixmap_new (color_area->window,
+	color_area_pixmap = gdk_pixmap_new (gtk_widget_get_window(color_area),
 					  color_area->allocation.width,
 					  color_area->allocation.height, -1);
-        color_area_mask = gdk_pixmap_new (color_area->window,
+        color_area_mask = gdk_pixmap_new (gtk_widget_get_window(color_area),
 					color_area->allocation.width,
 					color_area->allocation.height, 1);
       break;
@@ -402,7 +402,7 @@ color_area_events (GtkWidget *widget,
 	{
 	  if (!color_area_gc)
 	    {
-	      color_area_gc = gdk_gc_new (color_area->window);
+	      color_area_gc = gdk_gc_new (gtk_widget_get_window(color_area));
 	      mask_gc = gdk_gc_new (color_area_mask);
 	    }
 
diff --git a/app/create_object.c b/app/create_object.c
index 986da5c..7cb1654 100644
--- a/app/create_object.c
+++ b/app/create_object.c
@@ -108,7 +108,7 @@ create_object_button_press(CreateObjectTool *tool, GdkEventButton *event,
     tool->moving = TRUE;
     tool->last_to = handle2->pos;
     
-    gdk_pointer_grab (ddisp->canvas->window, FALSE,
+    gdk_pointer_grab (gtk_widget_get_window(ddisp->canvas), FALSE,
 		      GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK,
 		      NULL, NULL, event->time);
     ddisplay_set_all_cursor(get_cursor(CURSOR_SCROLL));
diff --git a/app/cursor.c b/app/cursor.c
index 86ffa90..89dbc19 100644
--- a/app/cursor.c
+++ b/app/cursor.c
@@ -85,7 +85,7 @@ get_cursor(DiaCursorType ctype) {
     } else {
       DDisplay *active_display = ddisplay_active (); 
       if (active_display != NULL) 
-	new_cursor = create_cursor(active_display->canvas->window,
+	new_cursor = create_cursor(gtk_widget_get_window(active_display->canvas),
 				   cursors[ctype].data,
 				   cursors[ctype].width,
 				   cursors[ctype].height,
diff --git a/app/defaults.c b/app/defaults.c
index 91ce172..91a222e 100644
--- a/app/defaults.c
+++ b/app/defaults.c
@@ -153,8 +153,8 @@ defaults_show(DiaObjectType *objtype, gpointer user_data)
 
   if (object_part != defaults) {
     gtk_window_resize (GTK_WINDOW(dialog), 1, 1); /* shrink to default */
-    if (dialog->window)
-      gdk_window_invalidate_rect (dialog->window, NULL, TRUE);
+    if (gtk_widget_get_window(dialog))
+      gdk_window_invalidate_rect (gtk_widget_get_window(dialog), NULL, TRUE);
   }
   gtk_window_present (GTK_WINDOW(dialog));
   object_part = defaults;
diff --git a/app/diacanvas.c b/app/diacanvas.c
index b66fc1d..09995f5 100644
--- a/app/diacanvas.c
+++ b/app/diacanvas.c
@@ -176,7 +176,7 @@ dia_canvas_send_configure (DiaCanvas *darea)
 
   widget = GTK_WIDGET (darea);
 
-  event->configure.window = g_object_ref (widget->window);
+  event->configure.window = g_object_ref (gtk_widget_get_window(widget));
   event->configure.send_event = TRUE;
   event->configure.x = widget->allocation.x;
   event->configure.y = widget->allocation.y;
@@ -359,10 +359,10 @@ dia_canvas_realize (GtkWidget *widget)
       
   widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, 
 				   attributes_mask);
-  gdk_window_set_user_data (widget->window, widget);
+  gdk_window_set_user_data (gtk_widget_get_window(widget), widget);
       
-  widget->style = gtk_style_attach (widget->style, widget->window);
-  gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
+  widget->style = gtk_style_attach (widget->style, gtk_widget_get_window(widget));
+  gtk_style_set_background (widget->style, gtk_widget_get_window(widget), GTK_STATE_NORMAL);
 
   dia_canvas_send_configure (DIA_CANVAS (widget));
 }
@@ -430,7 +430,7 @@ dia_canvas_size_allocate (GtkWidget     *widget,
 #else
   if (GTK_WIDGET_REALIZED (widget)) {
 #endif
-    gdk_window_move_resize (widget->window,
+    gdk_window_move_resize (gtk_widget_get_window(widget),
 			    allocation->x, 
 			    allocation->y,
 			    allocation->width, 
diff --git a/app/diapagelayout.c b/app/diapagelayout.c
index 142760e..701bbb6 100644
--- a/app/diapagelayout.c
+++ b/app/diapagelayout.c
@@ -603,7 +603,7 @@ darea_size_allocate(DiaPageLayout *self, GtkAllocation *allocation)
 static gint
 darea_expose_event(DiaPageLayout *self, GdkEventExpose *event)
 {
-  GdkWindow *window= self->darea->window;
+  GdkWindow *window = gtk_widget_get_window(self->darea);
   gfloat val;
   gint num;
 
diff --git a/app/disp_callbacks.c b/app/disp_callbacks.c
index 543f2dd..995fea9 100644
--- a/app/disp_callbacks.c
+++ b/app/disp_callbacks.c
@@ -374,7 +374,7 @@ ddisplay_realize(GtkWidget *widget, gpointer data)
   ddisp = (DDisplay *)data;
 
   gtk_im_context_set_client_window(GTK_IM_CONTEXT(ddisp->im_context),
-                                   GDK_WINDOW(ddisp->shell->window));
+                                   gtk_widget_get_window(ddisp->shell));
 }
 
 void
@@ -389,7 +389,7 @@ ddisplay_unrealize (GtkWidget *widget, gpointer data)
 
   if (ddisp->im_context)
     gtk_im_context_set_client_window(GTK_IM_CONTEXT(ddisp->im_context),
-                                     GDK_WINDOW(ddisp->shell->window));
+                                     gtk_widget_get_window(ddisp->shell));
 }
 
 void
@@ -596,7 +596,7 @@ ddisplay_canvas_events (GtkWidget *canvas,
   
   return_val = FALSE;
  
-  if (!canvas->window) 
+  if (!gtk_widget_get_window(canvas)) 
     return FALSE;
 
   switch (event->type)
@@ -798,7 +798,7 @@ ddisplay_canvas_events (GtkWidget *canvas,
 
       case GDK_MOTION_NOTIFY:
 	/*  get the pointer position  */
-	gdk_window_get_pointer (canvas->window, &tx, &ty, &tmask);
+	gdk_window_get_pointer (gtk_widget_get_window(canvas), &tx, &ty, &tmask);
 	hold_remove_handler();
 
         mevent = (GdkEventMotion *) event;
diff --git a/app/display.c b/app/display.c
index 243d3ed..26110b0 100644
--- a/app/display.c
+++ b/app/display.c
@@ -530,7 +530,7 @@ ddisplay_add_display_area(DDisplay *ddisp,
     bottom = dia_renderer_get_height_pixels (ddisp->renderer); 
   
   /* draw some rectangles to show where updates are...*/
-  /*  gdk_draw_rectangle(ddisp->canvas->window, ddisp->canvas->style->black_gc, TRUE, left, top, right-left,bottom-top); */
+  /*  gdk_draw_rectangle(gtk_widget_get_window(ddisp->canvas), ddisp->canvas->style->black_gc, TRUE, left, top, right-left,bottom-top); */
 
   /* Temporarily just do a union of all Irectangles: */
   if (ddisp->display_areas==NULL) {
@@ -595,7 +595,7 @@ ddisplay_update_handler(DDisplay *ddisp)
 
     g_return_val_if_fail (renderer->copy_to_window, FALSE);
     renderer->copy_to_window(ddisp->renderer, 
-                             ddisp->canvas->window,
+                             gtk_widget_get_window(ddisp->canvas),
                              ir->left, ir->top,
                              ir->right - ir->left, ir->bottom - ir->top);
     
@@ -1176,7 +1176,7 @@ ddisplay_set_renderer(DDisplay *ddisp, int aa_renderer)
     ddisp->renderer = new_gdk_renderer(ddisp);
   }
 
-  dia_renderer_set_size(ddisp->renderer, ddisp->canvas->window, width, height);
+  dia_renderer_set_size(ddisp->renderer, gtk_widget_get_window(ddisp->canvas), width, height);
 }
 
 void
@@ -1190,7 +1190,7 @@ ddisplay_resize_canvas(DDisplay *ddisp,
       ddisp->renderer = new_gdk_renderer(ddisp);
   }
 
-  dia_renderer_set_size(ddisp->renderer, ddisp->canvas->window, width, height);
+  dia_renderer_set_size(ddisp->renderer, gtk_widget_get_window(ddisp->canvas), width, height);
 
   ddisplay_set_origo(ddisp, ddisp->origo.x, ddisp->origo.y);
 
@@ -1482,8 +1482,8 @@ ddisplay_set_all_cursor(GdkCursor *cursor)
 void
 ddisplay_set_cursor(DDisplay *ddisp, GdkCursor *cursor)
 {
-  if (ddisp->canvas->window)
-    gdk_window_set_cursor(ddisp->canvas->window, cursor);
+  if (gtk_widget_get_window(ddisp->canvas))
+    gdk_window_set_cursor(gtk_widget_get_window(ddisp->canvas), cursor);
 }
 
 /** Returns whether the rulers are currently showing on the display.
diff --git a/app/linewidth_area.c b/app/linewidth_area.c
index ebe4526..0437a28 100644
--- a/app/linewidth_area.c
+++ b/app/linewidth_area.c
@@ -111,7 +111,7 @@ linewidth_area_draw (GtkWidget *linewidth_area)
 		      active_linewidth+4, height-1);
   }
 
-  gdk_draw_drawable (linewidth_area->window, linewidth_area_gc, linewidth_area_pixmap,
+  gdk_draw_drawable (gtk_widget_get_window(linewidth_area), linewidth_area_gc, linewidth_area_pixmap,
 		     0, 0, 0, 0, width, height);
 }
 
@@ -128,7 +128,7 @@ linewidth_area_events (GtkWidget *widget,
     case GDK_CONFIGURE:
       cevent = (GdkEventConfigure *)  event;
       if (cevent->width > 1) {
-	linewidth_area_pixmap = gdk_pixmap_new (widget->window,
+	linewidth_area_pixmap = gdk_pixmap_new (gtk_widget_get_window(widget),
 						cevent->width,
 						cevent->height, -1);
       }
diff --git a/app/magnify.c b/app/magnify.c
index 8827829..38bd6bb 100644
--- a/app/magnify.c
+++ b/app/magnify.c
@@ -30,7 +30,7 @@ magnify_button_press(MagnifyTool *tool, GdkEventButton *event,
   tool->y = tool->oldy = event->y;
   tool->box_active = TRUE;
   tool->moved = FALSE;
-  gdk_pointer_grab (ddisp->canvas->window, FALSE,
+  gdk_pointer_grab (gtk_widget_get_window(ddisp->canvas), FALSE,
 		    GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK,
 		    NULL, NULL, event->time);
 }
@@ -98,7 +98,7 @@ magnify_motion(MagnifyTool *tool, GdkEventMotion *event,
     tool->moved = TRUE;
 
     if (tool->gc == NULL) {
-      tool->gc = gdk_gc_new(ddisp->canvas->window);
+      tool->gc = gdk_gc_new(gtk_widget_get_window(ddisp->canvas));
       gdk_gc_set_line_attributes(tool->gc, 1, GDK_LINE_ON_OFF_DASH, 
 				 GDK_CAP_BUTT, GDK_JOIN_MITER);
       gdk_gc_set_foreground(tool->gc, &color_gdk_white);
@@ -108,13 +108,13 @@ magnify_motion(MagnifyTool *tool, GdkEventMotion *event,
     tl.x = MIN(tool->x, tool->oldx); tl.y = MIN(tool->y, tool->oldy);
     br.x = MAX(tool->x, tool->oldx); br.y = MAX(tool->y, tool->oldy);
 
-    gdk_draw_rectangle (ddisp->canvas->window,
+    gdk_draw_rectangle (gtk_widget_get_window(ddisp->canvas),
 			tool->gc, FALSE, tl.x, tl.y, br.x - tl.x, br.y - tl.y);
 
     tl.x = MIN(tool->x, event->x); tl.y = MIN(tool->y, event->y);
     br.x = MAX(tool->x, event->x); br.y = MAX(tool->y, event->y);
 
-    gdk_draw_rectangle (ddisp->canvas->window,
+    gdk_draw_rectangle (gtk_widget_get_window(ddisp->canvas),
 			tool->gc, FALSE, tl.x, tl.y, br.x - tl.x, br.y - tl.y);
 
     tool->oldx = event->x;
diff --git a/app/modify_tool.c b/app/modify_tool.c
index f9dd9bb..f19af08 100644
--- a/app/modify_tool.c
+++ b/app/modify_tool.c
@@ -204,7 +204,7 @@ static int do_if_clicked_handle(DDisplay *ddisp, ModifyTool *tool,
     tool->last_to = handle->pos;
     tool->handle = handle;
     tool->object = obj;
-    gdk_pointer_grab (ddisp->canvas->window, FALSE,
+    gdk_pointer_grab (gtk_widget_get_window(ddisp->canvas), FALSE,
                       GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK,
                       NULL, NULL, event->time);
     tool->start_at = handle->pos;
@@ -242,7 +242,7 @@ modify_button_press(ModifyTool *tool, GdkEventButton *event,
     tool->move_compensate = clicked_obj->position;
     point_sub(&tool->move_compensate, &clickedpoint);
     tool->break_connections = TRUE;
-    gdk_pointer_grab (ddisp->canvas->window, FALSE,
+    gdk_pointer_grab (gtk_widget_get_window(ddisp->canvas), FALSE,
                       GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK,
                       NULL, NULL, event->time);
     tool->start_at = clickedpoint;
@@ -256,18 +256,18 @@ modify_button_press(ModifyTool *tool, GdkEventButton *event,
     tool->y1 = tool->y2 = (int) event->y;
 
     if (tool->gc == NULL) {
-      tool->gc = gdk_gc_new(ddisp->canvas->window);
+      tool->gc = gdk_gc_new(gtk_widget_get_window(ddisp->canvas));
       gdk_gc_set_line_attributes(tool->gc, 1, GDK_LINE_ON_OFF_DASH, 
 				 GDK_CAP_BUTT, GDK_JOIN_MITER);
       gdk_gc_set_foreground(tool->gc, &color_gdk_white);
       gdk_gc_set_function(tool->gc, GDK_XOR);
     }
 
-    gdk_draw_rectangle (ddisp->canvas->window, tool->gc, FALSE,
+    gdk_draw_rectangle (gtk_widget_get_window (ddisp->canvas), tool->gc, FALSE,
 			tool->x1, tool->y1,
 			tool->x2 - tool->x1, tool->y2 - tool->y1);
 
-    gdk_pointer_grab (ddisp->canvas->window, FALSE,
+    gdk_pointer_grab (gtk_widget_get_window (ddisp->canvas), FALSE,
                       GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK,
                       NULL, NULL, event->time);
   }
@@ -585,7 +585,7 @@ modify_motion(ModifyTool *tool, GdkEventMotion *event,
 
     if (!auto_scroll && !tool->auto_scrolled)
     {
-      gdk_draw_rectangle (ddisp->canvas->window, tool->gc, FALSE,
+      gdk_draw_rectangle (gtk_widget_get_window (ddisp->canvas), tool->gc, FALSE,
 			  tool->x1, tool->y1,
 			  tool->x2 - tool->x1, tool->y2 - tool->y1);
     }
@@ -601,7 +601,7 @@ modify_motion(ModifyTool *tool, GdkEventMotion *event,
 			      MAX(tool->start_box.y, tool->end_box.y),
 			      &tool->x2, &tool->y2);
 
-    gdk_draw_rectangle (ddisp->canvas->window, tool->gc, FALSE,
+    gdk_draw_rectangle (gtk_widget_get_window (ddisp->canvas), tool->gc, FALSE,
 			tool->x1, tool->y1,
 			tool->x2 - tool->x1, tool->y2 - tool->y1);
     break;
@@ -739,7 +739,7 @@ modify_button_release(ModifyTool *tool, GdkEventButton *event,
     gdk_pointer_ungrab (event->time);
     /* Remove last box: */
     if (!tool->auto_scrolled) {
-      gdk_draw_rectangle (ddisp->canvas->window, tool->gc, FALSE,
+      gdk_draw_rectangle (gtk_widget_get_window (ddisp->canvas), tool->gc, FALSE,
 			tool->x1, tool->y1,
 			tool->x2 - tool->x1, tool->y2 - tool->y1);
     }
diff --git a/app/navigation.c b/app/navigation.c
index 19e3d3b..4d3facc 100644
--- a/app/navigation.c
+++ b/app/navigation.c
@@ -232,7 +232,7 @@ on_button_navigation_popup_pressed (GtkButton * button, gpointer _ddisp)
   gtk_widget_show (popup_window);
 
   /*miniframe style*/
-  nav->gc = gdk_gc_new (drawing_area->window);
+  nav->gc = gdk_gc_new (gtk_widget_get_window (drawing_area));
   gdk_gc_set_line_attributes (nav->gc,
                               FRAME_THICKNESS,
                               GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER);
@@ -253,14 +253,14 @@ on_button_navigation_popup_pressed (GtkButton * button, gpointer _ddisp)
   }
 
   /*grab the pointer*/
-  gdk_pointer_grab (drawing_area->window, TRUE,
+  gdk_pointer_grab (gtk_widget_get_window (drawing_area), TRUE,
                     GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_MOTION_MASK,
-                    drawing_area->window,
+                    gtk_widget_get_window (drawing_area),
                     nav->cursor,
                     GDK_CURRENT_TIME);
 
   /*buffer to draw the thumbnail on*/
-  nav->buffer = gdk_pixmap_new (drawing_area->window,
+  nav->buffer = gdk_pixmap_new (gtk_widget_get_window (drawing_area),
                                 nav->width, nav->height, -1);
   gdk_draw_rectangle (nav->buffer,
                       drawing_area->style->black_gc, TRUE,
@@ -311,7 +311,7 @@ static gboolean
 on_da_expose_event (GtkWidget * widget, GdkEventExpose * event, gpointer unused)
 {
   /*refresh the part outdated by the event*/
-  gdk_draw_drawable (widget->window,
+  gdk_draw_drawable (gtk_widget_get_window (widget),
 #if GTK_CHECK_VERSION(2,18,0)
                      widget->style->fg_gc[gtk_widget_get_state (widget)],
 #else
@@ -335,7 +335,7 @@ on_da_expose_event (GtkWidget * widget, GdkEventExpose * event, gpointer unused)
     y = (adj->value - adj->lower) / (adj->upper - adj->lower) * (nav->height) +1;
 
     /*draw directly on the window, do not buffer the miniframe*/
-    gdk_draw_rectangle (widget->window,
+    gdk_draw_rectangle (gtk_widget_get_window (widget),
                         nav->gc, FALSE,
                         x, y, nav->frame_w, nav->frame_h);
 
@@ -397,7 +397,7 @@ on_da_motion_notify_event (GtkWidget * drawing_area, GdkEventMotion * event, gpo
 
 /*--Draw the miniframe*/
 /*refresh from the buffer*/
-  gdk_draw_drawable (drawing_area->window,
+  gdk_draw_drawable (gtk_widget_get_window (drawing_area),
 #if GTK_CHECK_VERSION(2,18,0)
                      drawing_area->style->fg_gc[gtk_widget_get_state (drawing_area)],
 #else
@@ -406,7 +406,7 @@ on_da_motion_notify_event (GtkWidget * drawing_area, GdkEventMotion * event, gpo
                      GDK_PIXMAP(nav->buffer),
                      0, 0, 0, 0, nav->width, nav->height);
 /*draw directly on the window, do not buffer the miniframe*/
-  gdk_draw_rectangle (drawing_area->window,
+  gdk_draw_rectangle (gtk_widget_get_window (drawing_area),
                       nav->gc, FALSE,
                       x, y, w, h);
   return FALSE;
diff --git a/lib/diaarrowchooser.c b/lib/diaarrowchooser.c
index 4e55917..02c8509 100644
--- a/lib/diaarrowchooser.c
+++ b/lib/diaarrowchooser.c
@@ -195,7 +195,7 @@ dia_arrow_preview_expose(GtkWidget *widget, GdkEventExpose *event)
     x = (widget->allocation.x + misc->xpad);
     y = (widget->allocation.y + misc->ypad);
 
-    win = widget->window;
+    win = gtk_widget_get_window (widget);
 
     to.y = from.y = height/2;
     if (arrow->left) {
diff --git a/lib/dialinechooser.c b/lib/dialinechooser.c
index 35735cb..c4ede50 100644
--- a/lib/dialinechooser.c
+++ b/lib/dialinechooser.c
@@ -134,7 +134,7 @@ dia_line_preview_expose(GtkWidget *widget, GdkEventExpose *event)
     x = (widget->allocation.x + misc->xpad);
     y = (widget->allocation.y + misc->ypad);
 
-    win = widget->window;
+    win = gtk_widget_get_window (widget);
     gc = widget->style->fg_gc[widget->state];
 
     /* increase line width */



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