Some handlebox flaws




Looking at the latest handlebox, there are (as is no doubt realized)
some quirks.

I think reparenting into a new window _is_ the right thing to do
(I was worried about how different WM's would handle reparenting
onto the root window).

- Transient windows generically _will_ be decorated unlike
  override-redirect windows. If we don't want handleboxes to
  be sticky, that is a necessary evil, but we can ameliorate it
  by using WM specific hints to remove decorations where possible.

  The Motif hints are widely supported (at least by MWM, FVWM and
  descendants). There are also OpenLook hints that we could
  set simulataneously if anybody uses olvwm anymore.

  The FVWM code looks like a good reference. I think something
  like 

    gdk_window_set_decorations (GdkWindow *window, GdkWindowDecoration
                                *flags)

  Where flags is an enum with the values:

   GDK_DECORATION_BORDER
   GDK_DECORATION_RESIZEH
   GDK_DECORATION_TITLE
   GDK_DECORATION_MENU
   GDK_DECORATION_MINIMIZE
   GDK_DECORATION_MAXIMIZE

   (Plus probably _ALL/_NONE)

  Of course we could also go with an all or nothing approach, or combine
  this and other things into one "set_wm_hints" call.

  There are also

     Allowed functions (Motif specific) 
         RESIZE/MOVE/MINIMIZE/MAXIMIZE/CLOSE
       I don't think this is all that important.

     Icon name/pixmap/mask. (People seem to want this. In which
       case it should be added to the Window widget interface as well)

     Window groups
   
  Plus transient and override redirect if we want to allow people
  to get to the gory details.

- In delete float, return_if_fail needs to be convert to
   return_val_if_fail to suppress warnings. [nit]

- There are a lot of calls to gtk_window_move_resize going
   one, resulting in some strange transient behavior. Some
   time needs to be spent tracking down where they all come
   from.

- It is probably better to reparent before showing the float
  window (you'll have to force-realize it). This, and the
  g_return_if_fail nit are in the patch below.

So in conclusion, it is looking a bit rougher, but seems to
be fundementally sounder.

Regards,

                                        Owen


Index: gtkhandlebox.c
===================================================================
RCS file: /debian/home/gnomecvs/gtk+/gtk/gtkhandlebox.c,v
retrieving revision 1.20
diff -c -r1.20 gtkhandlebox.c
*** gtkhandlebox.c	1998/01/16 23:43:09	1.20
--- gtkhandlebox.c	1998/01/18 03:20:48
***************
*** 601,610 ****
  	      hb->is_onroot = TRUE;
  
  	      gdk_pointer_ungrab (GDK_CURRENT_TIME);
! 	      gtk_widget_show (hb->float_window);
  	      gtk_widget_set_uposition (hb->float_window, newx, newy);
- 	      
  	      gdk_window_reparent (widget->window, hb->float_window->window, 0, 0);
  
  	      while (gdk_pointer_grab (widget->window,
  				       FALSE,
--- 601,613 ----
  	      hb->is_onroot = TRUE;
  
  	      gdk_pointer_ungrab (GDK_CURRENT_TIME);
! 
! 	      if (!GTK_WIDGET_REALIZED (hb->float_window))
! 		gtk_widget_realize (hb->float_window);
! 
  	      gtk_widget_set_uposition (hb->float_window, newx, newy);
  	      gdk_window_reparent (widget->window, hb->float_window->window, 0, 0);
+ 	      gtk_widget_show (hb->float_window);
  
  	      while (gdk_pointer_grab (widget->window,
  				       FALSE,
***************
*** 628,637 ****
  {
    GtkHandleBox *hb;
  
!   g_return_if_fail (widget != NULL);
!   g_return_if_fail (event != NULL);
!   g_return_if_fail (data != NULL);
!   g_return_if_fail (GTK_IS_HANDLE_BOX (data));
  
    hb = GTK_HANDLE_BOX (data);
  
--- 631,640 ----
  {
    GtkHandleBox *hb;
  
!   g_return_val_if_fail (widget != NULL, FALSE);
!   g_return_val_if_fail (event != NULL, FALSE);
!   g_return_val_if_fail (data != NULL, FALSE);
!   g_return_val_if_fail (GTK_IS_HANDLE_BOX (data), FALSE);
  
    hb = GTK_HANDLE_BOX (data);
  



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