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

gEDA-cvs: pcb.git: branch: master updated (0809a6ec7d32e4acec5a6fcaca8a9fd8ab63e51a)



The branch, master has been updated
       via  0809a6ec7d32e4acec5a6fcaca8a9fd8ab63e51a (commit)
      from  a369bf7cf2cfffbf9c44fc5ef3be8b0f9beabc0e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


=========
 Summary
=========

 src/hid/gtk/gtkhid-gdk.c |   19 ++++++++++---------
 src/hid/gtk/gtkhid-gl.c  |   16 ++++++++--------
 2 files changed, 18 insertions(+), 17 deletions(-)


=================
 Commit Messages
=================

commit 0809a6ec7d32e4acec5a6fcaca8a9fd8ab63e51a
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    hid/gtk: Use gtk_widget_get_allocation() not gdk_window_get_geometry()
    
    This avoids an unnecessary round-trip the the X server on X11 platforms.

:100644 100644 ef3b30c... f0ce1ab... M	src/hid/gtk/gtkhid-gdk.c
:100644 100644 21a22e8... 13c45b0... M	src/hid/gtk/gtkhid-gl.c

=========
 Changes
=========

commit 0809a6ec7d32e4acec5a6fcaca8a9fd8ab63e51a
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    hid/gtk: Use gtk_widget_get_allocation() not gdk_window_get_geometry()
    
    This avoids an unnecessary round-trip the the X server on X11 platforms.

diff --git a/src/hid/gtk/gtkhid-gdk.c b/src/hid/gtk/gtkhid-gdk.c
index ef3b30c..f0ce1ab 100644
--- a/src/hid/gtk/gtkhid-gdk.c
+++ b/src/hid/gtk/gtkhid-gdk.c
@@ -1168,7 +1168,7 @@ ghid_pinout_preview_expose (GtkWidget *widget,
 {
   GhidPinoutPreview *pinout = GHID_PINOUT_PREVIEW (widget);
   GdkDrawable *save_drawable;
-  int da_w, da_h;
+  GtkAllocation allocation;
   view_data save_view;
   int save_width, save_height;
   double xz, yz;
@@ -1181,24 +1181,25 @@ ghid_pinout_preview_expose (GtkWidget *widget,
   save_width = gport->width;
   save_height = gport->height;
 
-  gdk_window_get_geometry (widget->window, 0, 0, &da_w, &da_h, 0);
-  xz = (double) pinout->x_max / da_w;
-  yz = (double) pinout->y_max / da_h;
+  gtk_widget_get_allocation (widget, &allocation);
+  xz = (double) pinout->x_max / allocation.width;
+  yz = (double) pinout->y_max / allocation.height;
   if (xz > yz)
     gport->view.coord_per_px = xz;
   else
     gport->view.coord_per_px = yz;
 
   gport->drawable = widget->window;
-  gport->width = da_w;
-  gport->height = da_h;
-  gport->view.width = da_w * gport->view.coord_per_px;
-  gport->view.height = da_h * gport->view.coord_per_px;
+  gport->width = allocation.width;
+  gport->height = allocation.height;
+  gport->view.width = allocation.width * gport->view.coord_per_px;
+  gport->view.height = allocation.height * gport->view.coord_per_px;
   gport->view.x0 = (pinout->x_max - gport->view.width) / 2;
   gport->view.y0 = (pinout->y_max - gport->view.height) / 2;
 
   /* clear background */
-  gdk_draw_rectangle (widget->window, priv->bg_gc, TRUE, 0, 0, da_w, da_h);
+  gdk_draw_rectangle (widget->window, priv->bg_gc, TRUE,
+                      0, 0, allocation.width, allocation.height);
 
   /* call the drawing routine */
   hid_expose_callback (&ghid_hid, NULL, &pinout->element);
diff --git a/src/hid/gtk/gtkhid-gl.c b/src/hid/gtk/gtkhid-gl.c
index 21a22e8..13c45b0 100644
--- a/src/hid/gtk/gtkhid-gl.c
+++ b/src/hid/gtk/gtkhid-gl.c
@@ -1028,7 +1028,7 @@ ghid_pinout_preview_expose (GtkWidget *widget,
   GdkGLContext* pGlContext = gtk_widget_get_gl_context (widget);
   GdkGLDrawable* pGlDrawable = gtk_widget_get_gl_drawable (widget);
   GhidPinoutPreview *pinout = GHID_PINOUT_PREVIEW (widget);
-  int da_w, da_h;
+  GtkAllocation allocation;
   view_data save_view;
   int save_width, save_height;
   double xz, yz;
@@ -1039,18 +1039,18 @@ ghid_pinout_preview_expose (GtkWidget *widget,
 
   /* Setup zoom factor for drawing routines */
 
-  gdk_window_get_geometry (widget->window, 0, 0, &da_w, &da_h, 0);
-  xz = (double) pinout->x_max / da_w;
-  yz = (double) pinout->y_max / da_h;
+  gtk_widget_get_allocation (widget, &allocation);
+  xz = (double) pinout->x_max / allocation.width;
+  yz = (double) pinout->y_max / allocation.height;
   if (xz > yz)
     gport->view.coord_per_px = xz;
   else
     gport->view.coord_per_px = yz;
 
-  gport->width = da_w;
-  gport->height = da_h;
-  gport->view.width = da_w * gport->view.coord_per_px;
-  gport->view.height = da_h * gport->view.coord_per_px;
+  gport->width = allocation.width;
+  gport->height = allocation.height;
+  gport->view.width = allocation.width * gport->view.coord_per_px;
+  gport->view.height = allocation.height * gport->view.coord_per_px;
   gport->view.x0 = (pinout->x_max - gport->view.width) / 2;
   gport->view.y0 = (pinout->y_max - gport->view.height) / 2;
 




_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs