Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] no background on GTK


Yes you are right but if you were to draw N times, you would see N draws on the Canvas.  If you redraw N times, you will see 1 draw, the next time you get back to the event loop.

The NO_RESIZE_REDRAW flag controls the damaging behavior when a control is resized.  The default is to damage the entire control.  So, when you resize a control to be smaller or larger, the whole thing is damaged.  When NO_RESIZE_REDRAW is set, resizing a control small causes no damage and resizing a control to be bigger causes a damaged region that is typically shaped like a backwards shape "L" (imagine dragging the bottom left corner of a top level window).  So, when you are implementing a control who's contents do not depend on the size of the control, create the canvas with NO_RESIZE_REDRAW.  An example of this kind of widget would be a list of strings.  When the window is resized smaller, no damaging is required because the strings just clip.  If you are implementing a label that wraps the text, then resizing does affect the contents of the control so you would create a canvas without NO_RES! IZE_REDRAW.

Steve



"Randy Hudson" <hudsonr@xxxxxxxxxx>
Sent by: platform-swt-dev-admin@xxxxxxxxxxx

04/05/02 01:03 PM
Please respond to platform-swt-dev

       
        To:        platform-swt-dev@xxxxxxxxxxx
        cc:        
        Subject:        Re: [platform-swt-dev] no background on GTK


I thought NO_RESIZE_REDRAW was to prevent flashing.  In what situations
would I see flash when using NO_RESIZE_REDRAW?

I suppose I don't see flashing because I always just create a GC on the
Control and paint, as opposed to calling control.redraw(x,y,w,h,boolean).
Is it incorrect to do this? (I am filling the entire control myself).



|---------+---------------------------------->
|         |           Steve_Northover@xxxxxxx|
|         |           Sent by:               |
|         |           platform-swt-dev-admin@|
|         |           eclipse.org            |
|         |                                  |
|         |                                  |
|         |           04/05/2002 12:04 PM    |
|         |           Please respond to      |
|         |           platform-swt-dev       |
|         |                                  |
|---------+---------------------------------->
 >-------------------------------------------------------------------------------------------------------------------|
 |                                                                                                                   |
 |       To:       platform-swt-dev@xxxxxxxxxxx                                                                      |
 |       cc:                                                                                                         |
 |       Subject:  Re: [platform-swt-dev] no background on GTK                                                       |
 |                                                                                                                   |
 |                                                                                                                   |
 >-------------------------------------------------------------------------------------------------------------------|




SWT.NO_BACKGROUND stops the control from automatically being
filled with the background color.  The idea is that application code can
get rid of flashing by painting the whole window once instead of erasing
and then painting.

On Windows, we makeWM_ERASEBKGND do nothing.
On X, we convince the server not to fill the X window.

On GTK ... we call gdk_window_set_back_pixmap()which is spec'd
to behave the same as X but this doesn't seem to work.

Steve


                                                                         
  "Bob Foster" <bob@xxxxxxxxxx>                                          
                                        To:                              
  Sent by:                      <platform-swt-dev@xxxxxxxxxxx>          
  platform-swt-dev-admin@eclips         cc:                              
  e.org                                 Subject:        Re:              
                                [platform-swt-dev] no background on GTK  
                                                                         
  04/04/02 05:53 PM                                                      
  Please respond to                                                      
  platform-swt-dev                                                      
                                                                         




This raises the question: What is SWT.NO_BACKGROUND is supposed to do?
Let's
say you set up a Canvas with no background that is "in front of" another
widget (drawn last). Shouldn't the other widget show through the canvas?
Instead, it appears that the widget in back is not drawn at all, which
means
that nothing is drawn and the desktop shows through the window.

I need a transparent canvas for my application. Why doesn't
SWT.NO_BACKGROUND give me that?

Bob
Object Factory Inc.

----- Original Message -----
From: <Silenio_Quarti@xxxxxxx>
To: <platform-swt-dev@xxxxxxxxxxx>
Sent: Thursday, April 04, 2002 3:24 PM
Subject: [platform-swt-dev] no background on GTK


> Havoc,
>
> We are trying to implement the SWT.NO_BACKGROUND style. This
> style determines with a widget will fill the background when
> an expose event happens.
>
> On X, it is possible to do this by setting the background
> pixmap of a Window to None.
>
> On GTK, the equivalent API is gdk_window_set_back_pixmap().
>
> If you run the test below, you will see that the shell
> will fill its background even though the test is setting
> the back pixmap to NULL.
>
> It seems that the background is not filled by X, but it is
> been filled by GTK. Havoc is there a away of avoiding this?
>
> Silenio
>
>
> Here is some code that shows the problem:
>
> public class NoBackgroundTest {
>
> public static void main (String [] args) throws Exception {
>         OS.gtk_init_check (new int [] {0}, null);
>
>         int shellHandle = OS.gtk_window_new (OS.GTK_WINDOW_TOPLEVEL);
>
>         OS.gtk_widget_realize(shellHandle);
>
>         int window = OS.GTK_WIDGET_WINDOW(shellHandle);
>         OS.gdk_window_set_back_pixmap(window, 0, false);
>
>         OS.gtk_widget_show(shellHandle);
>
>         while (OS.gtk_main_iteration() != 0);
> }
> }
> _______________________________________________
> platform-swt-dev mailing list
> platform-swt-dev@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/platform-swt-dev
>

_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-swt-dev




_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-swt-dev



Back to the top