change_frame_size (f, width, height, 0, 1, 0, 1);
SET_FRAME_GARBAGED (f);
cancel_mouse_face (f);
-#ifdef HAVE_PGTK
- pgtk_cr_destroy_surface (f);
-#endif
}
}
FIXME: gtk_widget_set_double_buffered is deprecated and might stop
working in the future. We need to migrate away from combining
X and GTK+ drawing to a pure GTK+ build. */
+
+#ifndef HAVE_PGTK
gtk_widget_set_double_buffered (wfixed, FALSE);
+#endif
#if ! GTK_CHECK_VERSION (3, 22, 0)
gtk_window_set_wmclass (GTK_WINDOW (wtop),
interpretation of even the system includes. */
#include <config.h>
+#include <cairo.h>
#include <fcntl.h>
#include <math.h>
#include <pthread.h>
#define FRAME_CR_CONTEXT(f) ((f)->output_data.pgtk->cr_context)
#define FRAME_CR_SURFACE(f) ((f)->output_data.pgtk->cr_surface)
+#define FRAME_CR_SURFACE_DESIRED_WIDTH(f) \
+ ((f)->output_data.pgtk->cr_surface_desired_width)
+#define FRAME_CR_SURFACE_DESIRED_HEIGHT(f) \
+ ((f)->output_data.pgtk->cr_surface_desired_height)
+
struct pgtk_display_info *x_display_list; /* Chain of existing displays */
extern Lisp_Object tip_frame;
if (f) {
PGTK_TRACE("%dx%d", alloc->width, alloc->height);
xg_frame_resized(f, alloc->width, alloc->height);
+ pgtk_cr_update_surface_desired_size(f, alloc->width, alloc->height);
}
}
if (f && widget == FRAME_GTK_OUTER_WIDGET (f)) {
PGTK_TRACE("%dx%d", event->configure.width, event->configure.height);
xg_frame_resized(f, event->configure.width, event->configure.height);
+ pgtk_cr_update_surface_desired_size(f, event->configure.width, event->configure.height);
}
return TRUE;
}
}
+
+void
+pgtk_cr_update_surface_desired_size (struct frame *f, int width, int height)
+{
+ PGTK_TRACE("pgtk_cr_update_surface_desired_size");
+
+ if (FRAME_CR_SURFACE_DESIRED_WIDTH (f) != width
+ || FRAME_CR_SURFACE_DESIRED_HEIGHT (f) != height)
+ {
+ cairo_surface_t *old_surface = FRAME_CR_SURFACE(f);
+ cairo_t *cr = NULL;
+ cairo_t *old_cr = FRAME_CR_CONTEXT(f);
+ FRAME_CR_SURFACE(f) = gdk_window_create_similar_surface(gtk_widget_get_window(FRAME_GTK_WIDGET(f)),
+ CAIRO_CONTENT_COLOR_ALPHA,
+ width,
+ height);
+
+ if (old_surface){
+ cr = cairo_create(FRAME_CR_SURFACE(f));
+ cairo_set_source_surface (cr, old_surface, 0, 0);
+
+ cairo_paint(cr);
+ FRAME_CR_CONTEXT (f) = cr;
+
+ cairo_destroy(old_cr);
+ cairo_surface_destroy (old_surface);
+ }
+ gtk_widget_queue_draw(FRAME_GTK_WIDGET(f));
+ FRAME_CR_SURFACE_DESIRED_WIDTH (f) = width;
+ FRAME_CR_SURFACE_DESIRED_HEIGHT (f) = height;
+ }
+}
+
+
cairo_t *
pgtk_begin_cr_clip (struct frame *f)
{
#ifdef USE_CAIRO
/* Cairo drawing context. */
cairo_t *cr_context;
+ int cr_surface_desired_width, cr_surface_desired_height;
/* Cairo surface for double buffering */
cairo_surface_t *cr_surface;
cairo_surface_t *cr_surface_visible_bell;
sigset_t *sigmask);
/* Cairo related functions implemented in pgtkterm.c */
+extern void pgtk_cr_update_surface_desired_size (struct frame *, int, int);
extern cairo_t *pgtk_begin_cr_clip (struct frame *f);
extern void pgtk_end_cr_clip (struct frame *f);
extern void pgtk_set_cr_source_with_gc_foreground (struct frame *f, Emacs_GC *gc);