On Thu, Feb 04, 2016 at 12:55:56PM +0200, Marius Gedminas wrote: > On Thu, Feb 04, 2016 at 12:33:37PM +0200, Marius Gedminas wrote: > > On Thu, Feb 04, 2016 at 12:06:57PM +0200, Marius Gedminas wrote: > > > The 'clearing ... 149 cells' messages in the log prove that this bit of > > > code > > > > > > set_cairo_source_rgb_from_pixel(cr, gui.bgcolor->pixel); > > > cairo_rectangle(cr, > > > FILL_X(col), FILL_Y(row), > > > num_cells * gui.char_width, gui.char_height); > > > cairo_fill(cr); > > > > > > was executed, so it remains to be discovered why it didn't clear > > > anything. Was there an active clipping rectangle? Was bgcolor->pixel > > > wrong? I'll try to add more debugging printfs(). > <...> > > Everything seems correct, so I've no idea why cairo isn't clearing that > > area :( > > I turned to IRC for help (#gnome-hackers on irc.gnome.org), and this is > the advice I received: > > <ebassi> mgedmin: Stop using gdk_cairo_create() and instead use the > cairo_t that GtkWidget::draw gives you > <ebassi> mgedmin: If you want to draw outside of the drawing code, > then create a surface using > gdk_window_create_similar_surface() or > gdk_window_create_similar_image_surface(), and draw on it; > then, inside the ::draw vfunc, use the surface as the source > on the cairo_t provided you by GtkWidget
Summarizing some further conversation: * GTK+ apps are supposed to do the drawing only from expose event callbacks (or the "draw" signal of the widget, I suppose). * If you need to draw at some other time, use gdk_window_invalidate_rect() to tell GTK+ that redrawing is needed, and you'll get an expose event. Perhaps the generic gui_redraw/gui_redraw_block() can be changed to call gdk_window_invalidate_rect(), and the draw_event() callback can be changed to do the drawing directly instead of calling gui_redraw()? Because otherwise I don't see how to pass the cairo context passed to draw_event() through the generic gui_redraw() code into internal drawing functions. Marius Gedminas -- Bumper sticker: No radio - Already stolen. -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
signature.asc
Description: Digital signature
