Can't draw to root window
- From: Chubb <chubb untraceable net>
- To: gtk-list gnome org
- Subject: Can't draw to root window
- Date: Thu, 18 Apr 2002 09:47:58 -0400
Hi.
I am trying to draw to the root window and am failing to do so.
Below is a small piece of code which shows the problem, I think.
Every time i try to do something to the root window (such as
gdk_draw_rectangle, nothing happens.
The code shows that the clipbox is set to (0,0,0,0), i.e., everything
sent to the rootwindow is clipped, so nothing appears on the screen.
(At least, I think that this is what is wrong.)
I think that I need to (somehow) get the clipbox to not be (0,0,0,0),
but I am not sure how to do this. Can anyone see what I am doing
wrong?
Also, the code below also shows that the size of the root window
is 1024x768, which is indeed my display size, so it looks like I
really am getting the root window appropriately. The output when
I run the snippet is:
Window type = 0
pstRegion=0x805c498
x=0 y=0 width=0 height=0
w=1024, h=768
iState=0
visible=1
And the code is this:
/*************************************************/
GtkWidget *pstRootWidget = NULL;
GdkWindow *pstRootWindow = NULL;
void vGraphicEnvironmentInitialization3(){
pstRootWindow = GDK_ROOT_PARENT();
g_print("window type = %d\n", gdk_window_get_window_type(pstRootWindow));
gdk_window_show(pstRootWindow);
{
GdkRegion* pstRegion = gdk_drawable_get_visible_region (pstRootWindow);
GdkRectangle* pstRectangle = malloc(4*sizeof(gint));
GdkWindowState iState = gdk_window_get_state(pstRootWindow);
int w, h;
g_print("pstRegion=%p\n", pstRegion); fflush(NULL);
gdk_region_get_clipbox(pstRegion, pstRectangle);
g_print("x=%d y=%d width=%d height=%d\n", pstRectangle->x,
pstRectangle->y, pstRectangle->width, pstRectangle->height);
gdk_drawable_get_size(pstRootWindow, &w, &h);
g_print("w=%d, h=%d\n", w, h);
g_print("iState=%d\n", iState);
g_print("visible=%d\n", gdk_window_is_visible(pstRootWindow));
};
};
int main(int argc, char *argv[] ){
gtk_init(&argc, &argv);
vGraphicEnvironmentInitialization3();
gtk_main ();
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]