2016-02-04 21:56 GMT+09:00 Marius Gedminas <[email protected]>:

> 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:
>

Nice.

>
> * GTK+ apps are supposed to do the drawing only from expose event
>   callbacks (or the "draw" signal of the widget, I suppose).
>

Unless referring to raw X11 events, I think it would be better to use the
term "draw signals" to avoid possible confusion.

It looks to me GTK+ 3 is trying to put Expose, GraphicsExpose, NoExpose and
VisibilityNotify X11 events behind "draw" signals to offer an easy-to-use
API.


> * 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.
>

Yes, that's what we should try first to have a window draw something.

>
> 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()?
>

It depends on whether a given draw event (I'm using the word loosely :) can
be handled asynchronously or not.  Sometimes, we want to do drawing
synchronously.

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.
>

I suspect what a cairo surface to the GTK+ 3 GUI what the global GdkGC to
the GTK+2 GUI.

Kazunobu

>
> 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.
>

-- 
-- 
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.

Raspunde prin e-mail lui