dotgnu-pnet-commits
[Top][All Lists]
Advanced

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

[Dotgnu-pnet-commits] CVS: pnetlib/Xsharp TopLevelWindow.cs,1.5,1.6 Wid


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/Xsharp TopLevelWindow.cs,1.5,1.6 Widget.cs,1.4,1.5 Xlib.cs.in,1.7,1.8
Date: Thu, 12 Jun 2003 22:39:31 -0400

Update of /cvsroot/dotgnu-pnet/pnetlib/Xsharp
In directory subversions:/tmp/cvs-serv19676/Xsharp

Modified Files:
        TopLevelWindow.cs Widget.cs Xlib.cs.in 
Log Message:


Implement form centering, in response to "StartPosition".


Index: TopLevelWindow.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Xsharp/TopLevelWindow.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** TopLevelWindow.cs   11 Jun 2003 07:07:19 -0000      1.5
--- TopLevelWindow.cs   13 Jun 2003 02:39:29 -0000      1.6
***************
*** 38,41 ****
--- 38,42 ----
        private bool hasPrimaryFocus;
        private bool reparented;
+       private bool firstMapDone;
        private IntPtr keyBuffer;
        private InputOnlyWidget focusWidget;
***************
*** 181,184 ****
--- 182,260 ----
                        }
  
+       // Perform a MoveResize request.
+       internal override void PerformMoveResize
+                               (IntPtr display, int newX, int newY,
+                                int newWidth, int newHeight)
+                       {
+                               Xlib.Window handle = GetWidgetHandle();
+                               XWindowChanges changes = new XWindowChanges();
+                               ConfigureWindowMask mask = 
(ConfigureWindowMask)0;
+ 
+                               // If we haven't mapped the window to the 
screen yet,
+                               // then set the size hints and bail out with a 
normal
+                               // move/resize event.
+                               if(!firstMapDone)
+                               {
+                                       XSizeHints hints = new XSizeHints();
+                                       if(newX != 0 || newY != 0)
+                                       {
+                                               hints.flags = 
SizeHintsMask.USPosition |
+                                                                         
SizeHintsMask.USSize;
+                                               hints.x = newX;
+                                               hints.y = newY;
+                                       }
+                                       else
+                                       {
+                                               hints.flags = 
SizeHintsMask.USSize;
+                                       }
+                                       hints.width = newWidth;
+                                       hints.height = newHeight;
+                                       Xlib.XSetWMNormalHints(display, handle, 
ref hints);
+                                       base.PerformMoveResize
+                                               (display, newX, newY, newWidth, 
newHeight);
+                                       return;
+                               }
+ 
+                               // Collect up the changes that need to be 
performed.
+                               if(newX != x || newY != y)
+                               {
+                                       if(newWidth != width || newHeight != 
height)
+                                       {
+                                               changes.x = newX;
+                                               changes.y = newY;
+                                               changes.width = newWidth;
+                                               changes.height = newHeight;
+                                               mask = ConfigureWindowMask.CWX |
+                                                          
ConfigureWindowMask.CWY |
+                                                          
ConfigureWindowMask.CWWidth |
+                                                          
ConfigureWindowMask.CWHeight;
+                                       }
+                                       else
+                                       {
+                                               changes.x = newX;
+                                               changes.y = newY;
+                                               mask = ConfigureWindowMask.CWX |
+                                                          
ConfigureWindowMask.CWY;
+                                       }
+                               }
+                               else if(newWidth != width || newHeight != 
height)
+                               {
+                                       changes.width = newWidth;
+                                       changes.height = newHeight;
+                                       mask = ConfigureWindowMask.CWWidth |
+                                                  ConfigureWindowMask.CWHeight;
+                               }
+ 
+                               // Send the reconfiguration request to the 
window manager.
+                               if(mask != (ConfigureWindowMask)0)
+                               {
+                                       Xlib.XReconfigureWMWindow
+                                                       (display, handle,
+                                                        Screen.ScreenNumber,
+                                                    
(uint)(ConfigureWindowMask.CWStackMode),
+                                                        ref changes);
+                               }
+                       }
+ 
        /// <summary>
        /// <para>Determine if this widget is currently iconified.</para>
***************
*** 227,230 ****
--- 303,307 ----
                                                Xlib.XMapRaised(display, 
GetWidgetHandle());
                                                mapped = true;
+                                               firstMapDone = true;
                                                OnMapStateChanged();
                                        }
***************
*** 312,315 ****
--- 389,393 ----
                                                        // We are mapped now as 
well.
                                                        mapped = true;
+                                                       firstMapDone = true;
                                                        OnMapStateChanged();
                                                }
***************
*** 660,664 ****
                                        changes.stack_mode = 0;         /* 
Above */
                                        Xlib.XReconfigureWMWindow
!                                                       (display, 
GetWidgetHandle(),
                                                         Screen.ScreenNumber,
                                                     
(uint)(ConfigureWindowMask.CWStackMode),
--- 738,742 ----
                                        changes.stack_mode = 0;         /* 
Above */
                                        Xlib.XReconfigureWMWindow
!                                                       (display, handle,
                                                         Screen.ScreenNumber,
                                                     
(uint)(ConfigureWindowMask.CWStackMode),
***************
*** 684,688 ****
                                        changes.stack_mode = 1;         /* 
Below */
                                        Xlib.XReconfigureWMWindow
!                                                       (display, 
GetWidgetHandle(),
                                                         Screen.ScreenNumber,
                                                     
(uint)(ConfigureWindowMask.CWStackMode),
--- 762,766 ----
                                        changes.stack_mode = 1;         /* 
Below */
                                        Xlib.XReconfigureWMWindow
!                                                       (display, handle,
                                                         Screen.ScreenNumber,
                                                     
(uint)(ConfigureWindowMask.CWStackMode),

Index: Widget.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Xsharp/Widget.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** Widget.cs   7 Jun 2003 00:13:09 -0000       1.4
--- Widget.cs   13 Jun 2003 02:39:29 -0000      1.5
***************
*** 707,726 ****
                        }
  
!       // Adjust the position and/or size of this widget.
!       private void AdjustPositionAndSize(IntPtr display, int newX, int newY,
!                                                                          int 
newWidth, int newHeight)
                        {
-                               // Make sure that the values are in range.
-                               if(newX < -32768 || newX > 32767 ||
-                                  newY < -32768 || newY > 32767)
-                               {
-                                       throw new 
XException(S._("X_InvalidPosition"));
-                               }
-                               else if(newWidth > 32767 || newHeight > 32767)
-                               {
-                                       throw new 
XException(S._("X_InvalidSize"));
-                               }
- 
-                               // Send requests to the X server to update its 
state.
                                if(newX != x || newY != y)
                                {
--- 707,715 ----
                        }
  
!       // Perform a MoveResize request.
!       internal virtual void PerformMoveResize
!                               (IntPtr display, int newX, int newY,
!                                int newWidth, int newHeight)
                        {
                                if(newX != x || newY != y)
                                {
***************
*** 742,745 ****
--- 731,753 ----
                                                                           
(uint)newWidth, (uint)newHeight);
                                }
+                       }
+ 
+       // Adjust the position and/or size of this widget.
+       private void AdjustPositionAndSize(IntPtr display, int newX, int newY,
+                                                                          int 
newWidth, int newHeight)
+                       {
+                               // Make sure that the values are in range.
+                               if(newX < -32768 || newX > 32767 ||
+                                  newY < -32768 || newY > 32767)
+                               {
+                                       throw new 
XException(S._("X_InvalidPosition"));
+                               }
+                               else if(newWidth > 32767 || newHeight > 32767)
+                               {
+                                       throw new 
XException(S._("X_InvalidSize"));
+                               }
+ 
+                               // Send requests to the X server to update its 
state.
+                               PerformMoveResize(display, newX, newY, 
newWidth, newHeight);
  
                                // Record the new widget information locally.

Index: Xlib.cs.in
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Xsharp/Xlib.cs.in,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** Xlib.cs.in  7 Jun 2003 07:40:16 -0000       1.7
--- Xlib.cs.in  13 Jun 2003 02:39:29 -0000      1.8
***************
*** 439,442 ****
--- 439,446 ----
                        (IntPtr display, Window w, Window prop_window);
  
+       [DllImport("X11")]
+       extern public static void XSetWMNormalHints
+                       (IntPtr display, Window w, ref XSizeHints hints);
+ 
        // Declare color-related external functions.
  





reply via email to

[Prev in Thread] Current Thread [Next in Thread]