Fixes several issues with grid registration of the dtwm panel on dtfile startup and...
authorEugene Doudine <dudinea@gmail.com>
Tue, 15 Apr 2014 14:25:49 +0000 (17:25 +0300)
committerJon Trulson <jon@radscan.com>
Sun, 20 Apr 2014 00:57:57 +0000 (18:57 -0600)
  The panel registration code rather stupidly assumed that display
  size is always 1280x1024 pixels. Because of this, depending on screen
  size, the panel could be registered somewhere in the center of the screen
  or completely or partially beyond of it.

  The panels were registered only on startup, not  those, which were added
  from UI.

The fix moves panel registration into separate routine and removes assumption
about display size. The fix yet is not complete since it still makes assumption
about panel's geometry: from dtfile there is still no way to find out
dinamically  the size of panel and it's location.

cde/programs/dtfile/Desktop.c
cde/programs/dtfile/Main.c
cde/programs/dtfile/Main.h

index fd07539722e46719deb0b8f453c9d488a3d3999f..cc6afe5b2b5525992a8d9676f5a7f47d46ddfd5d 100644 (file)
@@ -64,6 +64,7 @@
  *             PutOnDTCB
  *             RegisterIconDropsDT
  *             RegisterInGrid
+ *             RegisterPanelInGrid
  *             RemoveDT
  *             RemoveMovedObjectFromDT
  *             RunDTCommand
@@ -2451,6 +2452,33 @@ DTFileIsSelected (
    return(False);
 }
 
+/***********************************************************************
+ *
+ *  RegisterPanelInGrid - Registers the Dtwm planel in grid
+ *
+ *  Arguments: workspace - workspace number
+ *             displayWidth - width of worspace screen
+ *             displayHaight - height of workspace screen
+ *
+ ************************************************************************/
+
+void RegisterPanelInGrid(int workspace,  int displayWidth, int displayHeight )
+{
+   /* want to take out space where the FP lays ... Note this only for the
+      default size of the FP.  Right now there is no dynamic way of registering
+      the FP no matter what size it is */
+#define EXPECTED_PANEL_WIDTH 1105
+#define EXPECTED_PANEL_HEIGHT 83
+   RegisterInGrid(EXPECTED_PANEL_WIDTH, EXPECTED_PANEL_HEIGHT,
+                 /* the panel is expected to be horizontally centered */
+                 (displayWidth > EXPECTED_PANEL_WIDTH) ?
+                  (displayWidth - EXPECTED_PANEL_WIDTH) / 2 : 0,
+                 /* the panel is expected to be at the bottom of the screen */
+                 (displayHeight > EXPECTED_PANEL_HEIGHT) ?
+                   (displayHeight - EXPECTED_PANEL_HEIGHT) : displayHeight,
+                 workspace, True);
+}
+
 /***********************************************************************
  *
  *  InitializeDesktopGrid
@@ -2458,20 +2486,16 @@ DTFileIsSelected (
  ************************************************************************/
 
 void
-InitializeDesktopGrid( void )
+InitializeDesktopGrid( int displayWidth, int displayHeight)
 {
    int i,j,k;
 
    desktop_grid_size = desktop_data->numWorkspaces * numColumns * numRows;
    desktop_grid = (Boolean *)XtCalloc(1, desktop_grid_size);
 
-   /* want to take out space where the FP lays ... Note this only for the
-      default size of the FP.  Right now there is no dynamic way of registering
-      the FP no matter what size it is */
-
    for(i = 1; i <= desktop_data->numWorkspaces; i++)
    {
-      RegisterInGrid((int)1132, (int)115, 78, 910, i, True);
+      RegisterPanelInGrid(i, displayWidth, displayHeight);
    }
 }
 
@@ -3604,6 +3628,11 @@ InitializeNewWorkspaces (
          for(k = 0; k < numRows; k++)
             desktop_grid[(i * numRows * numColumns) +
                                            (j * numRows) + k] = False;
+
+      RegisterPanelInGrid( i + 1,
+                           DisplayWidth(display,screen),
+                           DisplayHeight(display, screen));
+
    }
    desktop_data->numWorkspaces = numInfo;
 
index c41ee3edb49ad0fa03334451073e57ecef09bed9..c5b1da875d0828fbfdb6dc2eccac3f2c2d991ab9 100644 (file)
@@ -1704,7 +1704,7 @@ _DtPerfChkpntMsgSend("Begin XtInitialize");
    /* go build 10 desktop windows */
    desktop_data = NULL;
    InitializeDesktopWindows(10, display);
-   InitializeDesktopGrid();
+   InitializeDesktopGrid(displayWidth, displayHeight);
 
    LoadDesktopInfo(application_args.session);
 
index 53abcefc6b1d99b5436803a124a2af43b31f8750..bb5008462e32ea564ea45df2e663499e21534edb 100644 (file)
@@ -1399,7 +1399,9 @@ extern void UnpostDTTextField(void) ;
 extern Boolean DTFileIsSelected(
                         DesktopRec *desktopRec,
                         FileViewData *fileViewData) ;
-extern void InitializeDesktopGrid( void ) ;
+extern void InitializeDesktopGrid(
+                        int displayWidth,
+                        int displayHeight) ;
 extern void RegisterInGrid(
                         int width,
                         int height,