RE: The Window expose-event with gtk_window_resize() problem:
- From: "Tom Liu" <tom liu flextrade com>
- To: <gtk-app-devel-list gnome org>
- Subject: RE: The Window expose-event with gtk_window_resize() problem:
- Date: Thu, 8 Jul 2004 11:13:44 -0400
Hi,
I post the question week ago, still can't find the answer.
Can some one take a look and help me out this problem? I need this to be
done.
Thanks.
Tom.
-----Original Message-----
From: Tom Liu [mailto:tom liu flextrade com]
Sent: Tuesday, July 06, 2004 11:55 AM
To: 'Owen Taylor'; 'Jan-Marek Glogowski'
Cc: 'gtk-app-devel-list gnome org'
Subject: RE: The Window expose-event with gtk_window_resize() problem:
Set_double_buffered will bring another problem. If I put an label in
the
window, when other windows covers this window and move away, the label
will disappear!
Please try the following code.
//----------------------------------------------------------------------
--
--
#include "gtk/gtk.h"
#include "stdio.h"
static gboolean expose(GtkWidget * widget, GdkEvent *event, gpointer
data)
{
int x,y,w,h;
x=y=0;
w=widget->allocation.width;
h=widget->allocation.height;
fprintf(stderr,"Debug:%s,%d:expose:wid:%d,hi:%d,\n",__FILE__,__LINE_
_,w,h);
gdk_window_clear(widget->window);// clear all this window;
gdk_draw_rectangle(widget->window,(widget->style-
black_gc),false,5,5,w-10,h-10);
return FALSE;
}
static gboolean press(GtkWidget * widget, GdkEvent *event, gpointer
data)
{
gtk_window_resize(GTK_WINDOW(widget),widget-
allocation.width+20,widget->allocation.height+20);
//
gdk_window_resize(widget->window,widget->allocation.width+20,widget-
allocation.height+20);
return FALSE;
}
int main( int argc, char *argv[] )
{
GtkWidget *window;
GtkWidget *lbl;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_app_paintable(window, TRUE);
gtk_widget_set_double_buffered (window,false);
gtk_widget_set_events(window,GDK_BUTTON_PRESS_MASK|
GDK_EXPOSURE_MASK);
g_signal_connect (G_OBJECT (window), "delete_event", G_CALLBACK
(gtk_main_quit), NULL);
g_signal_connect(G_OBJECT(window),"expose-
event",G_CALLBACK(expose),NULL);
g_signal_connect(G_OBJECT(window), "button_press_event",
G_CALLBACK(press), NULL);
gtk_container_set_border_width(GTK_CONTAINER(window),40);
lbl=gtk_label_new("this is a label");
gtk_widget_set_double_buffered (lbl,false);
gtk_container_add(GTK_CONTAINER(window),lbl);
gtk_widget_show_all(window);
gtk_main ();
return 0;
}
//----------------------------------------------------------------------
--
Thanks.
Tom.
-----Original Message-----
From: Owen Taylor [mailto:otaylor redhat com]
Sent: Friday, July 02, 2004 3:25 PM
To: Jan-Marek Glogowski
Cc: Tom Liu; gtk-app-devel-list gnome org
Subject: RE: The Window expose-event with gtk_window_resize()
problem:
On Sat, 2004-07-03 at 01:04, Jan-Marek Glogowski wrote:
Hi
I think there might be a problem in the "double buffering" code.
If
you
set
gtk_widget_set_double_buffered( window, FALSE );
you get single exposures.
What's a single exposure?
set_double_buffered (widget, FALSE) makes that widget *not*
double buffered. widgets are double buffered by default.
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]