From 5544a0fb396f93c2b460c3df139ebb71868fd967 Mon Sep 17 00:00:00 2001 From: Eugene Doudine Date: Tue, 15 Apr 2014 17:25:49 +0300 Subject: [PATCH] Fixes several issues with grid registration of the dtwm panel on dtfile startup and on workspace addition: 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 | 41 ++++++++++++++++++++++++++++++----- cde/programs/dtfile/Main.c | 2 +- cde/programs/dtfile/Main.h | 4 +++- 3 files changed, 39 insertions(+), 8 deletions(-) diff --git a/cde/programs/dtfile/Desktop.c b/cde/programs/dtfile/Desktop.c index fd075397..cc6afe5b 100644 --- a/cde/programs/dtfile/Desktop.c +++ b/cde/programs/dtfile/Desktop.c @@ -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; diff --git a/cde/programs/dtfile/Main.c b/cde/programs/dtfile/Main.c index c41ee3ed..c5b1da87 100644 --- a/cde/programs/dtfile/Main.c +++ b/cde/programs/dtfile/Main.c @@ -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); diff --git a/cde/programs/dtfile/Main.h b/cde/programs/dtfile/Main.h index 53abcefc..bb500846 100644 --- a/cde/programs/dtfile/Main.h +++ b/cde/programs/dtfile/Main.h @@ -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, -- 2.25.1