]> www.fi.muni.cz Git - evince.git/blobdiff - shell/ev-utils.c
[dualscreen] fix crash on ctrl+w and fix control window closing
[evince.git] / shell / ev-utils.c
index 8c94f6e1180a89c316d8769520a902fea5a24fbc..8c9bae5501617027009d9be62379e668bc136ad4 100644 (file)
@@ -14,7 +14,7 @@
  *
  *  You should have received a copy of the GNU General Public License
  *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
  */
 
@@ -187,9 +187,8 @@ ev_pixbuf_add_shadow (GdkPixbuf *src, int size,
  * the region code.
  */
 void
-ev_print_region_contents (GdkRegion *region)
+ev_print_region_contents (cairo_region_t *region)
 {
-       GdkRectangle *rectangles = NULL;
        gint n_rectangles, i;
 
        if (region == NULL) {
@@ -198,17 +197,19 @@ ev_print_region_contents (GdkRegion *region)
        }
 
        g_print ("<region %p>\n", region);
-       gdk_region_get_rectangles (region, &rectangles, &n_rectangles);
+       n_rectangles = cairo_region_num_rectangles (region);
        for (i = 0; i < n_rectangles; i++) {
+               GdkRectangle rect;
+
+               cairo_region_get_rectangle (region, i, &rect);
                g_print ("\t(%d %d, %d %d) [%dx%d]\n",
-                        rectangles[i].x,
-                        rectangles[i].y,
-                        rectangles[i].x + rectangles[i].width,
-                        rectangles[i].y + rectangles[i].height,
-                        rectangles[i].width,
-                        rectangles[i].height);
+                        rect.x,
+                        rect.y,
+                        rect.x + rect.width,
+                        rect.y + rect.height,
+                        rect.width,
+                        rect.height);
        }
-       g_free (rectangles);
 }
 
 static void
@@ -224,7 +225,7 @@ ev_gui_sanitise_popup_position (GtkMenu *menu,
 
        g_return_if_fail (widget != NULL);
 
-       gtk_widget_size_request (GTK_WIDGET (menu), &req);
+       gtk_widget_get_preferred_size (GTK_WIDGET (menu), &req, NULL);
 
        monitor_num = gdk_screen_get_monitor_at_point (screen, *x, *y);
        gtk_menu_set_monitor (menu, monitor_num);
@@ -247,16 +248,18 @@ ev_gui_menu_position_tree_selection (GtkMenu   *menu,
        GtkTreeView *tree_view = GTK_TREE_VIEW (user_data);
        GtkWidget *widget = GTK_WIDGET (user_data);
        GtkRequisition req;
+       GtkAllocation allocation;
        GdkRectangle visible;
 
-       gtk_widget_size_request (GTK_WIDGET (menu), &req);
-       gdk_window_get_origin (widget->window, x, y);
+       gtk_widget_get_preferred_size (GTK_WIDGET (menu), &req, NULL);
+       gdk_window_get_origin (gtk_widget_get_window (widget), x, y);
+       gtk_widget_get_allocation (widget, &allocation);
 
-       *x += (widget->allocation.width - req.width) / 2;
+       *x += (allocation.width - req.width) / 2;
 
        /* Add on height for the treeview title */
        gtk_tree_view_get_visible_rect (tree_view, &visible);
-       *y += widget->allocation.height - visible.height;
+       *y += allocation.height - visible.height;
 
        selection = gtk_tree_view_get_selection (tree_view);
        selected_rows = gtk_tree_selection_get_selected_rows (selection, &model);