mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-13 22:10:08 +00:00
gtk-demo: Get rid of gdk_drawable_get_size() usage
This commit is contained in:
parent
9826c31a9f
commit
f5ad38fdc4
@ -475,7 +475,6 @@ gtk_rotated_bin_draw (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
GtkRotatedBin *bin = GTK_ROTATED_BIN (widget);
|
GtkRotatedBin *bin = GTK_ROTATED_BIN (widget);
|
||||||
GdkWindow *window;
|
GdkWindow *window;
|
||||||
gint width, height;
|
|
||||||
gdouble s, c;
|
gdouble s, c;
|
||||||
gdouble w, h;
|
gdouble w, h;
|
||||||
|
|
||||||
@ -502,8 +501,10 @@ gtk_rotated_bin_draw (GtkWidget *widget,
|
|||||||
cairo_translate (cr, -child_area.width / 2, -child_area.height / 2);
|
cairo_translate (cr, -child_area.width / 2, -child_area.height / 2);
|
||||||
|
|
||||||
/* clip */
|
/* clip */
|
||||||
gdk_drawable_get_size (bin->offscreen_window, &width, &height);
|
cairo_rectangle (cr,
|
||||||
cairo_rectangle (cr, 0, 0, width, height);
|
0, 0,
|
||||||
|
gdk_window_get_width (bin->offscreen_window),
|
||||||
|
gdk_window_get_height (bin->offscreen_window));
|
||||||
cairo_clip (cr);
|
cairo_clip (cr);
|
||||||
/* paint */
|
/* paint */
|
||||||
cairo_set_source_surface (cr, surface, 0, 0);
|
cairo_set_source_surface (cr, surface, 0, 0);
|
||||||
@ -512,12 +513,12 @@ gtk_rotated_bin_draw (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
if (gtk_cairo_should_draw_window (cr, bin->offscreen_window))
|
if (gtk_cairo_should_draw_window (cr, bin->offscreen_window))
|
||||||
{
|
{
|
||||||
gdk_drawable_get_size (bin->offscreen_window, &width, &height);
|
|
||||||
|
|
||||||
gtk_paint_flat_box (gtk_widget_get_style (widget), cr,
|
gtk_paint_flat_box (gtk_widget_get_style (widget), cr,
|
||||||
GTK_STATE_NORMAL, GTK_SHADOW_NONE,
|
GTK_STATE_NORMAL, GTK_SHADOW_NONE,
|
||||||
widget, "blah",
|
widget, "blah",
|
||||||
0, 0, width, height);
|
0, 0,
|
||||||
|
gdk_window_get_width (bin->offscreen_window),
|
||||||
|
gdk_window_get_height (bin->offscreen_window));
|
||||||
|
|
||||||
if (bin->child)
|
if (bin->child)
|
||||||
gtk_container_propagate_draw (GTK_CONTAINER (widget),
|
gtk_container_propagate_draw (GTK_CONTAINER (widget),
|
||||||
|
@ -381,7 +381,6 @@ gtk_mirror_bin_draw (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
GtkMirrorBin *bin = GTK_MIRROR_BIN (widget);
|
GtkMirrorBin *bin = GTK_MIRROR_BIN (widget);
|
||||||
GdkWindow *window;
|
GdkWindow *window;
|
||||||
gint width, height;
|
|
||||||
|
|
||||||
window = gtk_widget_get_window (widget);
|
window = gtk_widget_get_window (widget);
|
||||||
if (gtk_cairo_should_draw_window (cr, window))
|
if (gtk_cairo_should_draw_window (cr, window))
|
||||||
@ -389,11 +388,12 @@ gtk_mirror_bin_draw (GtkWidget *widget,
|
|||||||
cairo_surface_t *surface;
|
cairo_surface_t *surface;
|
||||||
cairo_matrix_t matrix;
|
cairo_matrix_t matrix;
|
||||||
cairo_pattern_t *mask;
|
cairo_pattern_t *mask;
|
||||||
|
int height;
|
||||||
|
|
||||||
if (bin->child && gtk_widget_get_visible (bin->child))
|
if (bin->child && gtk_widget_get_visible (bin->child))
|
||||||
{
|
{
|
||||||
surface = gdk_offscreen_window_get_surface (bin->offscreen_window);
|
surface = gdk_offscreen_window_get_surface (bin->offscreen_window);
|
||||||
gdk_drawable_get_size (bin->offscreen_window, &width, &height);
|
height = gdk_window_get_height (bin->offscreen_window);
|
||||||
|
|
||||||
/* paint the offscreen child */
|
/* paint the offscreen child */
|
||||||
cairo_set_source_surface (cr, surface, 0, 0);
|
cairo_set_source_surface (cr, surface, 0, 0);
|
||||||
@ -422,12 +422,12 @@ gtk_mirror_bin_draw (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
else if (gtk_cairo_should_draw_window (cr, bin->offscreen_window))
|
else if (gtk_cairo_should_draw_window (cr, bin->offscreen_window))
|
||||||
{
|
{
|
||||||
gdk_drawable_get_size (bin->offscreen_window, &width, &height);
|
|
||||||
|
|
||||||
gtk_paint_flat_box (gtk_widget_get_style (widget), cr,
|
gtk_paint_flat_box (gtk_widget_get_style (widget), cr,
|
||||||
GTK_STATE_NORMAL, GTK_SHADOW_NONE,
|
GTK_STATE_NORMAL, GTK_SHADOW_NONE,
|
||||||
widget, "blah",
|
widget, "blah",
|
||||||
0, 0, width, height);
|
0, 0,
|
||||||
|
gdk_window_get_width (bin->offscreen_window),
|
||||||
|
gdk_window_get_height (bin->offscreen_window));
|
||||||
|
|
||||||
if (bin->child)
|
if (bin->child)
|
||||||
gtk_container_propagate_draw (GTK_CONTAINER (widget),
|
gtk_container_propagate_draw (GTK_CONTAINER (widget),
|
||||||
|
Loading…
Reference in New Issue
Block a user