Re: Please explain 1st arg of configure & expose event functions...



>This widget that is the first argument seems to be the window
>that _contains_ the pixmap drawing from what you are saying.

no. its the widget for which the event took place and for which the
signal is being emitted. this mistake has caused you much later
confusion. 

>I'm confused because some elements of this window object
>are used to give information about the _pixmap_?!?!?

it seems you don't have much of a grounding in XWindow basics, which
is leading to your confusion (you could think of them as GDK basics,
but GDK's model comes mostly from XWindow).

anything that gets drawn on the screen must be drawn on an object
called a "window". that includes text, lines, pixmaps, rectangles,
whatever. 

a pixmap itself is really just a set of data containing pixel
values. by itself, that won't cause anything to appear on the
screen. for it to be visible, it has to be drawn. for it to be drawn,
there has to be a window to draw it into. thus, the widget (i.e. a C
struct) that is used to display pixmaps contains both info about the
pixmap itself, and info about a window (a GdkWindow, specifically)
into which it is drawn.

now, this window has *nothing* to do with the kind of window you are
thinking about. its just a rectangular area of the
screen. specifically, it is *not* a GtkWindow (notice the "t" instead
of the "d"), it is not a widget, and it is not managed by your window
manager. its just a part of the screen where things may be drawn. most
widgets have a window associated with them, though a number of them do
not, and draw onto their container/parent's window (or their
grand-parent's window, or whatever).

to repeat: you cannot draw without a GdkWindow. the GdkWindow does not
contain the pixmap the way a GtkWindow would, it is where the pixmap
is drawn. a pixmap widget contains info about the pixmap and a pointer
to the GdkWindow where the data in the pixmap will be drawn.

>Shouldn't we be using the "style" of the pixmap??  (By the way, unrelated:
>why do we need event->area.x * event->area.y args twice?)
>
>   gdk_draw_pixmap(widget->window, widget->style->fg_gc[GTK_WIDGET_STATE(widge
>t)],
>      Pixmaps::powerSpectralDensityPlot, event->area.x, event->area.y,
>      event->area.x, event->area.y, event->area.width, event->area.height);

look at the docs for gdk_draw_pixmap, and it will be clear.

--p



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]