Expose events and unrendered chunks of screen



I'm having yet another "fit and finish" type problem, on which I'd really like some advice because there seems to be an underlying problem I don't understand.

In my program, I have a 1024x768 window covering the screen. The Xserver runs with a virtual res of 1024x769 due to a hardware weirdness. I handle expose_events for the window by blitting a window-sized pixbuf onto the window area directly.

Now take a look at this snippet from my startup code:

        // Initialize windowing library and hide cursor
        gtk_init(&argc, &argv);
        gdk_rgb_init();
        screenX = gdk_screen_width();
        screenY = gdk_screen_height();

        useless.red = useless.green = useless.blue = 0;
        useless.pixel = 0;
        mainwindow = gtk_window_new(GTK_WINDOW_POPUP);
        gtk_widget_set_usize(mainwindow, screenX, screenY);
        gtk_widget_set_uposition(mainwindow,0,0);

        gtk_widget_show_all(mainwindow);
        gdk_window_set_background(mainwindow->window, &useless);

        // ... some internal code to set my entire offscreen buf black

        // copy buffer to window
        XPEG_RenderDisplay();

        // COMMENT1
        while (g_main_iteration(FALSE));
        // COMMENT2
        XPEG_RenderDisplay();
        // COMMENT3
        while (g_main_iteration(FALSE));

XPEG_RenderDisplay() just blits my offscreen buffer onto the window. It's the same function I call for expose_event.

If I omit the lines from COMMENT2 onwards, when my program starts up it will flash a (correct) black window, then the window will fill with light gray. I need to have those extra two lines to fill the window with black again and wait for the event queue (?) to empty.

Secondly, I sometimes call an external program that switches the display down to 640x480 and runs some video. When this program exits and my program returns, a 640x480 hole in the middle of my window is light gray despite the fact that I handled the expose_event. (And I put a trace message in there and yes the expose_event is being handled by my code - but something ELSE is called after me).

It seems as if something "on top of" my window has an undesirable default behavior. How can I override this?

--
-- Lewin A.R.W. Edwards (Embedded Engineer)
Work     http://www.digi-frame.com/
Personal http://www.larwe.com/
Tel (914) 937-4090 9am-6pm ET M-F






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