diff --git a/cde/configure.ac b/cde/configure.ac index a6886a50e..e8c2f78c1 100644 --- a/cde/configure.ac +++ b/cde/configure.ac @@ -436,6 +436,41 @@ AC_CHECK_LIB(Xinerama, XineramaQueryScreens, [SOURCE_CPP_DEFINES="${SOURCE_CPP_DEFINES} -DUSE_XINERAMA"], [AC_MSG_ERROR([libXinerama not found])], $X_LIBS) +############################################################################ +# Check if support for the XRENDER extension was requested and available. +############################################################################ +AC_ARG_ENABLE(xrender, + AC_HELP_STRING([--disable-xrender], [disable XRender]) ) +if test "$enable_xrender" != "no"; then + +# if test "$use_pkgconfig_xrender" = "yes" ; then +# XRENDER_CFLAGS=`$PKGCONFIG --cflags xrender` +# XRENDER_LDFLAGS=`$PKGCONFIG --libs xrender` +# else + XRENDER_LDFLAGS="-lXrender" +# fi + + AC_CHECK_HEADERS([X11/extensions/Xrender.h], [], + [ + enable_xrender="no"; + AC_MSG_WARN([unable to use X11/extensions/Xrender.h]) + ], [ +#include + ]) + +fi +if test "$enable_xrender" != "no" ; then + AC_CHECK_LIB(Xrender, XRenderComposite, + [ LDFLAGS="$LDFLAGS $XRENDER_LDFLAGS" + CFLAGS="$CFLAGS $XRENDER_CFLAGS" + SOURCE_CPP_DEFINES="${SOURCE_CPP_DEFINES} -DUSE_XRENDER" + enable_xrender="yes" + AC_DEFINE(USE_XRENDER, 1, [Define to enable the XRender extension]) ], + [ enable_xrender="no" + AC_MSG_WARN([unable to use the XRender extension]) ], + [ $XRENDER_LDFLAGS ]) +fi + dnl Special check for tirpc... AC_CHECK_LIB(tirpc, svc_register, [CFLAGS="${CFLAGS} -DOPT_TIRPC -I/usr/include/tirpc"; diff --git a/cde/include/Dt/Wsm.h b/cde/include/Dt/Wsm.h index 7e37b3a83..83574e42a 100644 --- a/cde/include/Dt/Wsm.h +++ b/cde/include/Dt/Wsm.h @@ -52,10 +52,19 @@ extern "C" { #define DtWSM_REASON_CURRENT 4 + /* * Types */ +/* Which style is the workspace background image */ +typedef enum { + DtWSM_BACKDROP_IMAGETYPE_TILED = 0, + DtWSM_BACKDROP_IMAGETYPE_CENTER = 1, + DtWSM_BACKDROP_IMAGETYPE_FIT = 2, + DtWSM_BACKDROP_IMAGETYPE_FILL = 3 +} DtWsmBackdropImageType; + /* Workspace property information */ typedef struct _DtWsmWorkspaceInfo { @@ -67,6 +76,7 @@ typedef struct _DtWsmWorkspaceInfo { char *pchTitle; Window *backdropWindows; int numBackdropWindows; + DtWsmBackdropImageType imageType; /**< Tiled, Center, Fit, Fill */ } DtWsmWorkspaceInfo; diff --git a/cde/include/Dt/WsmP.h b/cde/include/Dt/WsmP.h index 9d32e116b..ab5c8aae4 100644 --- a/cde/include/Dt/WsmP.h +++ b/cde/include/Dt/WsmP.h @@ -447,7 +447,7 @@ _DtWmRestart( /*************************************<->************************************* * - * int _DtWsmChangeBackdrop (display, root, path, pixmap) + * int _DtWsmChangeBackdrop (display, root, path, pixmap, imageType) * * * Description: @@ -461,6 +461,7 @@ _DtWmRestart( * root - root window of screen * path - file path to bitmap file * pixmap - pixmap id of backdrop pixmap + * imageType - Style of backdrop, tiled, center, fit or fill * * Returns: * -------- @@ -472,7 +473,8 @@ _DtWsmChangeBackdrop ( Display *display, Window root, char *path, - Pixmap pixmap); + Pixmap pixmap, + DtWsmBackdropImageType imageType); /*************************************<->************************************* * diff --git a/cde/lib/DtSvc/DtUtil1/WmChBackD.c b/cde/lib/DtSvc/DtUtil1/WmChBackD.c index 095977a4e..f4958ee4e 100644 --- a/cde/lib/DtSvc/DtUtil1/WmChBackD.c +++ b/cde/lib/DtSvc/DtUtil1/WmChBackD.c @@ -86,13 +86,13 @@ DtWsmChangeBackdrop ( char *path, Pixmap pixmap) { - return _DtWsmChangeBackdrop(display, root, path, pixmap); + return _DtWsmChangeBackdrop(display, root, path, pixmap, DtWSM_BACKDROP_IMAGETYPE_TILED); } /*************************************<->************************************* * - * _DtWsmChangeBackdrop (display, root, path, pixmap) + * _DtWsmChangeBackdrop (display, root, path, pixmap, imageType) * * * Description: @@ -106,6 +106,7 @@ DtWsmChangeBackdrop ( * root - root window of screen * path - file path to bitmap file * pixmap - pixmap id of backdrop pixmap + * imageType - Style of backdrop, tiled, center, fit or fill * * Returns: * -------- @@ -120,7 +121,8 @@ _DtWsmChangeBackdrop ( Display *display, Window root, char *path, - Pixmap pixmap) + Pixmap pixmap, + DtWsmBackdropImageType imageType) { int rval = BadAtom; Window wmWindow; @@ -147,8 +149,8 @@ _DtWsmChangeBackdrop ( pch = (char *) XtMalloc (len * sizeof(char)); - sprintf (pch, "%s %s %lx", DTWM_REQ_CHANGE_BACKDROP, path, - pixmap); + sprintf (pch, "%s %s %lx %d", DTWM_REQ_CHANGE_BACKDROP, path, + pixmap, imageType); /* * Make the request by appending the string to diff --git a/cde/lib/DtSvc/DtUtil1/WmGWsInfo.c b/cde/lib/DtSvc/DtUtil1/WmGWsInfo.c index 96df789e4..6b6d11e7d 100644 --- a/cde/lib/DtSvc/DtUtil1/WmGWsInfo.c +++ b/cde/lib/DtSvc/DtUtil1/WmGWsInfo.c @@ -184,6 +184,13 @@ DtWsmGetWorkspaceInfo( item++; } + /* imageType */ + if (item < count) + { + pWsInfo->imageType = atoi (ppchList[item]); + item++; + } + /* number of backdrop windows */ if (item < count) { diff --git a/cde/programs/dtstyle/Backdrop.c b/cde/programs/dtstyle/Backdrop.c index 987aade51..1e0ee803d 100644 --- a/cde/programs/dtstyle/Backdrop.c +++ b/cde/programs/dtstyle/Backdrop.c @@ -64,6 +64,8 @@ #include #include #include +#include +#include #include
@@ -73,6 +75,7 @@ #include
#include
#include
+#include
#include "Help.h" #include "Main.h" @@ -138,6 +141,14 @@ static void _DtMapCB( typedef struct { Widget drawnButton; + Widget imageStyleTB; + Widget imageTypeRC; + Widget tiledTG; + Widget centeredTG; +#if defined(USE_XRENDER) + Widget fitTG; + Widget fillTG; +#endif /* USE_XRENDER */ char **dirList; int dirCount; char **tmpBitmapNames; @@ -288,6 +299,24 @@ void SelectCurrentBackdrop(int callback) } } + switch(wInfo->imageType) { +#if defined(USE_XRENDER) + case DtWSM_BACKDROP_IMAGETYPE_FILL: + XmToggleButtonGadgetSetState(backdrops.fillTG, True, False); + break; + case DtWSM_BACKDROP_IMAGETYPE_FIT: + XmToggleButtonGadgetSetState(backdrops.fitTG, True, False); + break; +#endif /* USE_XRENDER */ + case DtWSM_BACKDROP_IMAGETYPE_CENTER: + XmToggleButtonGadgetSetState(backdrops.centeredTG, True, False); + break; + case DtWSM_BACKDROP_IMAGETYPE_TILED: + default: + XmToggleButtonGadgetSetState(backdrops.tiledTG, True, False); + break; + } + XtFree((char *) backdropName); XtFree((char *) wInfo); } @@ -342,6 +371,8 @@ CreateBackdropDialog( XmString *listStrings; char *bd_desc; char *lang; + XmString string; + Widget imageStyleForm; if (backdrops.noBitmaps) @@ -472,6 +503,58 @@ CreateBackdropDialog( XtSetArg (args[n], XmNallowOverlap, False); n++; mainForm = XmCreateForm (style.backdropDialog, "backdropsForm", args, n); + n = 0; + string = CMPSTR((char *)GETMESSAGE(11, 13, "Backdrop Style")); + XtSetArg (args[n], XmNtitleString, string); n++; + XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++; + XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++; + XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++; + backdrops.imageStyleTB + = _DtCreateTitleBox(mainForm, "imageStyleTB", args, n); + XmStringFree(string); + + n = 0; + XtSetArg(args[n], XmNallowOverlap, False); n++; + XtSetArg(args[n], XmNchildType, XmWORK_AREA); n++; + imageStyleForm = + XmCreateForm(backdrops.imageStyleTB, "imageStyleForm", args, n); + + n = 0; + XtSetArg(args[n], XmNmarginWidth, 0); n++; + XtSetArg(args[n], XmNmarginHeight, 0); n++; + backdrops.imageTypeRC = + XmCreateRadioBox(imageStyleForm, "imageTypeRC", args, n); + + n = 0; + string = CMPSTR((char *)GETMESSAGE(11, 14, "Tiled")); + XtSetArg(args[n], XmNlabelString, string); n++; + backdrops.tiledTG = + XmCreateToggleButtonGadget(backdrops.imageTypeRC, "tiledTG", args, n); + XmStringFree(string); + + n = 0; + string = CMPSTR((char *)GETMESSAGE(11, 15, "Center")); + XtSetArg(args[n], XmNlabelString, string); n++; + backdrops.centeredTG = + XmCreateToggleButtonGadget(backdrops.imageTypeRC, "centeredTG", args, n); + XmStringFree(string); + +#if defined(USE_XRENDER) + n = 0; + string = CMPSTR((char *)GETMESSAGE(11, 16, "Fit")); + XtSetArg(args[n], XmNlabelString, string); n++; + backdrops.fitTG = + XmCreateToggleButtonGadget(backdrops.imageTypeRC, "fitTG", args, n); + XmStringFree(string); + + n = 0; + string = CMPSTR((char *)GETMESSAGE(11, 17, "Fill")); + XtSetArg(args[n], XmNlabelString, string); n++; + backdrops.fillTG = + XmCreateToggleButtonGadget(backdrops.imageTypeRC, "fillTG", args, n); + XmStringFree(string); +#endif /* USE_XRENDER */ + /* create the scrolled list of bitmap names... first create XmStrings */ listStrings = MakeListStrings (); n = 0; @@ -486,7 +569,8 @@ CreateBackdropDialog( /* set up attachments for scrolled list itself */ n = 0; XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++; + XtSetArg (args[n], XmNrightAttachment, XmATTACH_WIDGET); n++; + XtSetArg (args[n], XmNrightWidget, backdrops.imageStyleTB); n++; XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++; XtSetValues (XtParent(list), args, n); @@ -512,6 +596,15 @@ CreateBackdropDialog( XtManageChild (mainForm); XtManageChild (backdrops.drawnButton); XtManageChild (list); + XtManageChild(backdrops.imageStyleTB); + XtManageChild(imageStyleForm); + XtManageChild(backdrops.imageTypeRC); + XtManageChild(backdrops.tiledTG); + XtManageChild(backdrops.centeredTG); +#if defined(USE_XRENDER) + XtManageChild(backdrops.fitTG); + XtManageChild(backdrops.fillTG); +#endif /* USE_XRENDER */ return 1; } @@ -974,9 +1067,24 @@ ButtonCB( { int n, num; Arg args[MAX_ARGS]; + DtWsmBackdropImageType imageType; DtDialogBoxCallbackStruct *cb = (DtDialogBoxCallbackStruct *) call_data; +#if defined(USE_XRENDER) + if(XmToggleButtonGadgetGetState(backdrops.fillTG)) { + imageType = DtWSM_BACKDROP_IMAGETYPE_FILL; + } else if (XmToggleButtonGadgetGetState(backdrops.fitTG)) { + imageType = DtWSM_BACKDROP_IMAGETYPE_FIT; + } else +#endif /* USE_XRENDER */ + if (XmToggleButtonGadgetGetState(backdrops.centeredTG)) { + imageType = DtWSM_BACKDROP_IMAGETYPE_CENTER; + } else { + /* Default to tiled */ + imageType = DtWSM_BACKDROP_IMAGETYPE_TILED; + } + switch (cb->button_position) { case B_APPLY_BUTTON: @@ -986,7 +1094,8 @@ ButtonCB( _DtWsmChangeBackdrop(style.display, style.root, backdrops.bitmapNames[num], - backdrops.bitmaps[num]); + backdrops.bitmaps[num], + imageType); break; case B_OK_BUTTON: @@ -996,7 +1105,8 @@ ButtonCB( _DtWsmChangeBackdrop(style.display, style.root, backdrops.bitmapNames[num], - backdrops.bitmaps[num]); + backdrops.bitmaps[num], + imageType); XtUnmanageChild(w); break; diff --git a/cde/programs/dtstyle/dtstyle.msg b/cde/programs/dtstyle/dtstyle.msg index e24b41cd2..f64f5cef2 100644 --- a/cde/programs/dtstyle/dtstyle.msg +++ b/cde/programs/dtstyle/dtstyle.msg @@ -381,6 +381,14 @@ files available. Check $HOME/.dt/errorlog. $ _DtMessage 12 is the title of the Backdrop dialog box 12 Style Manager - Backdrop +$ Group box for chosing style of backdrop +13 Backdrop Style + +$ Styles of backdrop +14 Tiled +15 Centered +16 Fit +17 Fill $set 12 $ _DtMessage set 12 is for the Screen dialog diff --git a/cde/programs/dtwm/WmBackdrop.c b/cde/programs/dtwm/WmBackdrop.c index 57fa77fdc..0570112f3 100644 --- a/cde/programs/dtwm/WmBackdrop.c +++ b/cde/programs/dtwm/WmBackdrop.c @@ -31,6 +31,12 @@ #define BOTTOM 0 #define CHANGE_BACKDROP (1L << 0) +#if defined(USE_XRENDER) +#include +#endif /* USE_XRENDER */ + +#include
+ #include "WmGlobal.h" #include "WmResource.h" #include "WmResNames.h" @@ -294,13 +300,137 @@ ProcessBackdropResources( XGetGeometry( display, tmpPix, &win, &x, &y, &w, &h, &bw, &depth); - pWS->backdrop.imagePixmap = - XCreatePixmap(display, tmpPix, w, h, depth); gc = XCreateGC(display, tmpPix, 0, NULL); - status = XCopyArea( - XtDisplay(pWS->workspaceTopLevelW), - tmpPix, pWS->backdrop.imagePixmap, gc, - 0, 0, w, h, 0, 0); + + if(pWS->backdrop.imageType == DtWSM_BACKDROP_IMAGETYPE_CENTER) + { + /* Centered */ + if(pWS->backdrop.window) { + unsigned int wbw, wdepth, wh, ww; + Window wwin; + int wx, wy; + /* Find the size of the containing background, to centre the pixmap + * within */ + XGetGeometry( + display, pWS->backdrop.window, + &wwin, &wx, &wy, &ww, &wh, &wbw, &wdepth); + + /* Create a pixmap the size of the whole desktop */ + pWS->backdrop.imagePixmap = + XCreatePixmap(display, tmpPix, ww, wh, depth); + + /* Clear the background to a theme specific bg colour */ + XSetForeground(display, gc, pWS->backdrop.background); + XFillRectangle(display, pWS->backdrop.imagePixmap, gc, 0, 0, ww, wh); + + /* Copy in the pixmap to the middle, also handles the pixmap being + * larger or smaller than the desktop */ + status = XCopyArea( + XtDisplay(pWS->workspaceTopLevelW), + tmpPix, pWS->backdrop.imagePixmap, gc, + 0, 0, w, h, (ww - w) / 2, (wh - h) / 2); + } + } +#if defined(USE_XRENDER) + else if(pWS->backdrop.imageType == DtWSM_BACKDROP_IMAGETYPE_FIT + || pWS->backdrop.imageType == DtWSM_BACKDROP_IMAGETYPE_FILL) + { + int minor_version, major_version; + + /* USE_XRENDER just checks if the compile time enviroment + * had the Xrender library, this runtime check makes sure + * the current server has the X render extension installed + * and available */ + if(XRenderQueryVersion(display, &minor_version, &major_version)) { + + /* Fill the screen */ + if(pWS->backdrop.window) { + unsigned int wbw, wdepth, wh, ww; + Window wwin; + int wx, wy; + double xscale; + double yscale; + XRenderPictureAttributes pic_attributes; + Picture src_pict; + Picture dst_pict; + int resizedW; + int resizedH; + + /* Find the size of the containing background, to centre the pixmap + * within */ + XGetGeometry( + display, pWS->backdrop.window, + &wwin, &wx, &wy, &ww, &wh, &wbw, &wdepth); + + /* Create a pixmap the size of the whole desktop */ + pWS->backdrop.imagePixmap = + XCreatePixmap(display, tmpPix, ww, wh, depth); + + /* Clear the background to a theme specific bg colour */ + XSetForeground(display, gc, pWS->backdrop.background); + XFillRectangle(display, pWS->backdrop.imagePixmap, gc, 0, 0, ww, wh); + + /* Fill scales to the whole area */ + xscale = (double) w / (double) ww; + yscale = (double) h / (double) wh; + + /* Whereas Fit, scales to one axis and applies that scale to both */ + /* preserving aspect ratio */ + if(pWS->backdrop.imageType == DtWSM_BACKDROP_IMAGETYPE_FIT) { + if(xscale > yscale) { + yscale = xscale; + } else { + xscale = yscale; + } + } + + XTransform xform = {{ + { XDoubleToFixed(xscale), XDoubleToFixed(0), XDoubleToFixed(0) }, + { XDoubleToFixed(0), XDoubleToFixed(yscale), XDoubleToFixed(0) }, + { XDoubleToFixed(0), XDoubleToFixed(0), XDoubleToFixed(1.0) } + }}; + + /* Convert pixmaps to Pictures for Xrender */ + src_pict = XRenderCreatePicture(display, + tmpPix, + XRenderFindStandardFormat(display, PictStandardRGB24), + 0, + &pic_attributes); + dst_pict = XRenderCreatePicture(display, + pWS->backdrop.imagePixmap, + XRenderFindStandardFormat(display, PictStandardRGB24), + 0, + &pic_attributes); + + if(src_pict && dst_pict) { + XRenderSetPictureTransform(display, src_pict, &xform); + + resizedW = (double) w / xscale; + resizedH = (double) h / yscale; + + XRenderComposite(display, PictOpOver, + src_pict, 0, dst_pict, /* src, mask, dest */ + 0, 0, /* src xy (in destination space!) */ + 0, 0, /* mask xy */ + (ww - resizedW) / 2, (wh - resizedH) / 2, ww, wh); + } + + if(src_pict) { XRenderFreePicture(display, src_pict); } + if(dst_pict) { XRenderFreePicture(display, dst_pict); } + } + } + } +#endif /* USE_XRENDER */ + else + { + /* Tiled */ + pWS->backdrop.imagePixmap = + XCreatePixmap(display, tmpPix, w, h, depth); + status = XCopyArea( + XtDisplay(pWS->workspaceTopLevelW), + tmpPix, pWS->backdrop.imagePixmap, gc, + 0, 0, w, h, 0, 0); + } XFreeGC(display, gc); } @@ -346,7 +476,7 @@ ProcessBackdropResources( if (pWS->backdrop.imagePixmap != XmUNSPECIFIED_PIXMAP) { - xswa.override_redirect = True; + xswa.override_redirect = True; xswa.background_pixmap = pWS->backdrop.imagePixmap; xswamask = CWOverrideRedirect | CWBackPixmap; @@ -541,7 +671,7 @@ FullBitmapFilePath( /******************************<->************************************* * - * SetNewBackdrop (pWS, pixmap, aName) + * SetNewBackdrop (pWS, pixmap, aName, imageType) * * Description: * ----------- @@ -552,6 +682,7 @@ FullBitmapFilePath( * pWS = pointer to workspace data * pixmap = pixmap for the backdrop (if any) * aName = atomized name for the backdrop (either file name or "none") + * imageType = Style of backdrop, tiled, center, fit or fill * * Outputs: * ------- @@ -566,7 +697,8 @@ void SetNewBackdrop( WmWorkspaceData *pWS, Pixmap pixmap, - String bitmapFile ) + String bitmapFile, + DtWsmBackdropImageType imageType ) { String pchNewBitmap = NULL; @@ -604,6 +736,7 @@ SetNewBackdrop( pWS->backdrop.imagePixmap = pixmap; pWS->backdrop.image = pchNewBitmap; + pWS->backdrop.imageType = imageType; ProcessBackdropResources (pWS, CHANGE_BACKDROP); @@ -614,6 +747,7 @@ SetNewBackdrop( ChangeBackdrop (pWS); SaveWorkspaceResources (pWS, WM_RES_BACKDROP_IMAGE); + SaveWorkspaceResources (pWS, WM_RES_BACKDROP_IMAGETYPE); SetWorkspaceInfoProperty (pWS); diff --git a/cde/programs/dtwm/WmBackdrop.h b/cde/programs/dtwm/WmBackdrop.h index 6f8c7b66c..5c76dddee 100644 --- a/cde/programs/dtwm/WmBackdrop.h +++ b/cde/programs/dtwm/WmBackdrop.h @@ -38,7 +38,8 @@ extern String FullBitmapFilePath( extern void SetNewBackdrop( WmWorkspaceData *pWS, Pixmap pixmap, - String bitmapFile) ; + String bitmapFile, + DtWsmBackdropImageType imageType) ; extern Boolean IsBackdropWindow( WmScreenData *pSD, Window win) ; diff --git a/cde/programs/dtwm/WmEvent.c b/cde/programs/dtwm/WmEvent.c index 9091e332d..2d53ec6a1 100644 --- a/cde/programs/dtwm/WmEvent.c +++ b/cde/programs/dtwm/WmEvent.c @@ -63,6 +63,7 @@ #include "WmResParse.h" #include "WmParse.h" #include "WmParseP.h" +#include "Dt/Wsm.h" #include /* for MS_LastManagedMenuTime */ extern XmMenuState _XmGetMenuState(); @@ -1998,6 +1999,7 @@ HandleDtWmRequest (WmScreenData *pSD, XEvent *pev) strlen(DTWM_REQ_CHANGE_BACKDROP))) { Pixmap pixmap = None; + DtWsmBackdropImageType imageType = DtWSM_BACKDROP_IMAGETYPE_TILED; char *pch; char *pchFile = NULL; @@ -2025,7 +2027,18 @@ HandleDtWmRequest (WmScreenData *pSD, XEvent *pev) if (pch) { sscanf (pch, "%lx", &pixmap); - SetNewBackdrop (ACTIVE_WS, pixmap, (String)pchFile); + + pch = strtok (NULL, " "); + if (pch) + { + sscanf (pch, "%d", (int *) &imageType); + + SetNewBackdrop (ACTIVE_WS, pixmap, (String)pchFile, imageType); + } + else + { + Warning (((char *)GETMESSAGE(32, 5, "Missing backdrop image style number for backdrop change request."))); + } } else { diff --git a/cde/programs/dtwm/WmGlobal.h b/cde/programs/dtwm/WmGlobal.h index 3d06f4b3f..9aa2c31ec 100644 --- a/cde/programs/dtwm/WmGlobal.h +++ b/cde/programs/dtwm/WmGlobal.h @@ -331,6 +331,7 @@ extern Pixel FPselectcolor; #define WM_RES_FP_POSITION (1L << 4) #define WM_RES_ICONBOX_GEOMETRY (1L << 5) #define WM_RES_WORKSPACE_COUNT (1L << 6) +#define WM_RES_BACKDROP_IMAGETYPE (1L << 7) @@ -1352,6 +1353,7 @@ typedef struct _WmBackdropData int colorSet; /* resource */ Pixel background; /* resource */ Pixel foreground; /* resource */ + DtWsmBackdropImageType imageType; /* resource */ unsigned int flags; Window window; } BackdropData; diff --git a/cde/programs/dtwm/WmProperty.c b/cde/programs/dtwm/WmProperty.c index ba8bf4e7b..eeeb21f99 100644 --- a/cde/programs/dtwm/WmProperty.c +++ b/cde/programs/dtwm/WmProperty.c @@ -1322,7 +1322,7 @@ SetWorkspaceInfoProperty (WmWorkspaceData *pWS) * number of backdrop windows * list of backdrop windows */ - iNumStrings = 6; /* number of fields minus backdrop window(s) */ + iNumStrings = 7; /* number of fields minus backdrop window(s) */ count = 1; /* number of backdrop windows */ iNumStrings += count; @@ -1356,6 +1356,11 @@ SetWorkspaceInfoProperty (WmWorkspaceData *pWS) sprintf (&pch[ix], "0x%lx", pWS->backdrop.nameAtom); ppchList[i++] = &pch[ix]; + /* backdrop type */ + ix = (i * WIP_NUMBER_SIZE); + sprintf (&pch[ix], "%d", pWS->backdrop.imageType); + ppchList[i++] = &pch[ix]; + /* number of backdrop windows */ ix = (i * WIP_NUMBER_SIZE); if (pWS->backdrop.window == None) diff --git a/cde/programs/dtwm/WmResNames.h b/cde/programs/dtwm/WmResNames.h index bba1a8bde..7cb3030f8 100644 --- a/cde/programs/dtwm/WmResNames.h +++ b/cde/programs/dtwm/WmResNames.h @@ -91,6 +91,7 @@ #define WmNimage "image" #define WmNimageBackground "imageBackground" #define WmNimageForeground "imageForeground" +#define WmNimageType "imageType" #define WmNinteractivePlacement "interactivePlacement" #define WmNkeyBindings "keyBindings" #define WmNkeyboardFocusPolicy "keyboardFocusPolicy" @@ -252,6 +253,7 @@ #define WmCImage "Image" #define WmCImageBackground "ImageBackground" #define WmCImageForeground "ImageForeground" +#define WmCImageType "ImageType" #define WmCInteractivePlacement "InteractivePlacement" #define WmCKeyBindings "KeyBindings" #define WmCKeyboardFocusPolicy "KeyboardFocusPolicy" diff --git a/cde/programs/dtwm/WmResource.c b/cde/programs/dtwm/WmResource.c index 5d174c590..d561a7f61 100644 --- a/cde/programs/dtwm/WmResource.c +++ b/cde/programs/dtwm/WmResource.c @@ -1620,6 +1620,16 @@ XtResource wmBackdropResources[] = (XtPointer)NULL }, + { + WmNimageType, + WmCImageType, + XtRInt, + sizeof (int), + XtOffsetOf (BackdropData, imageType), + XtRInt, + (XtPointer)DtWSM_BACKDROP_IMAGETYPE_TILED + }, + }; @@ -5122,7 +5132,11 @@ ProcessWorkspaceResources (WmWorkspaceData *pWS) WmNbackdrop, WmCBackdrop, wmBackdropResources, XtNumber (wmBackdropResources), NULL, 0); + /* This call will create the backdrop windows of the correct size */ ProcessBackdropResources (pWS, 0); + /* 1 = CHANGE_BACKDROP HACK this call will handle changing from the + * default tiled, to centered, fill or fit */ + ProcessBackdropResources (pWS, 1); } /* END OF FUNCTION ProcessWorkspaceResources */ diff --git a/cde/programs/dtwm/WmWrkspace.c b/cde/programs/dtwm/WmWrkspace.c index 38cfd769a..4da75e4c8 100644 --- a/cde/programs/dtwm/WmWrkspace.c +++ b/cde/programs/dtwm/WmWrkspace.c @@ -3443,6 +3443,25 @@ SaveWorkspaceResources( AddStringToResourceData (buffer, &data, &cum_len); } + if (flags & WM_RES_BACKDROP_IMAGETYPE) + { + iLen = (strlen (res_class) + strlen (screenName) + + strlen (pWS->name) + strlen (WmNbackdrop) + + strlen (WmNimageType) + 22); + + if (iLen > bufferLength) + { + bufferLength += iLen; + buffer = (char *) + XtRealloc (buffer, bufferLength * sizeof(char)); + } + + sprintf (buffer, "%s%s*%s*%s*%s: %d\n", res_class, + screenName, pWS->name, + WmNbackdrop, WmNimageType, pWS->backdrop.imageType); + + AddStringToResourceData (buffer, &data, &cum_len); + } if (flags & WM_RES_WORKSPACE_TITLE) { diff --git a/cde/programs/dtwm/dtwm.msg b/cde/programs/dtwm/dtwm.msg index 985062480..c1c6acd92 100644 --- a/cde/programs/dtwm/dtwm.msg +++ b/cde/programs/dtwm/dtwm.msg @@ -189,7 +189,7 @@ $ YOU DON'T NEED TO LOCALIZE THIS SET. 2 Insufficient memory to handle backdrop change. 3 Missing path name for backdrop change request. 4 Missing pixmap id for backdrop change request. - +5 Missing backdrop image style number for backdrop change request. $set 34 $ THIS COMMENT FOR DTWM TEAM ONLY -- WmIPlace.c -- diff --git a/cde/programs/localized/de_DE.UTF-8/msg/dtstyle.msg b/cde/programs/localized/de_DE.UTF-8/msg/dtstyle.msg index a13396f60..5cc0ad1ba 100644 --- a/cde/programs/localized/de_DE.UTF-8/msg/dtstyle.msg +++ b/cde/programs/localized/de_DE.UTF-8/msg/dtstyle.msg @@ -408,6 +408,15 @@ $ _DtMessage 12 is the title of the Backdrop dialog box 12 "Umgebungsverwaltung - Hintergrund" +$ Group box for chosing style of backdrop +13 Hintergrundstil + +$ Styles of backdrop +14 Kachel +15 Zentriert +16 Anpassen +17 Ausfüllen + $set 12 Redefine set# $ _DtMessage set 12 is for the Screen dialog diff --git a/cde/programs/localized/es_ES.UTF-8/msg/dtstyle.msg b/cde/programs/localized/es_ES.UTF-8/msg/dtstyle.msg index cc315742f..5a0e150a5 100644 --- a/cde/programs/localized/es_ES.UTF-8/msg/dtstyle.msg +++ b/cde/programs/localized/es_ES.UTF-8/msg/dtstyle.msg @@ -404,6 +404,15 @@ $ _DtMessage 12 is the title of the Backdrop dialog box 12 "Gestor de estilos - Fondo" +$ Group box for chosing style of backdrop +13 Estillo de Fondo + +$ Styles of backdrop +14 Mosaico +15 Centro +16 Ajustar +17 Rellenar + $set 12 Redefine set# $ _DtMessage set 12 is for the Screen dialog diff --git a/cde/programs/localized/fr_FR.UTF-8/msg/dtstyle.msg b/cde/programs/localized/fr_FR.UTF-8/msg/dtstyle.msg index 43b2eff24..80b9dbff0 100644 --- a/cde/programs/localized/fr_FR.UTF-8/msg/dtstyle.msg +++ b/cde/programs/localized/fr_FR.UTF-8/msg/dtstyle.msg @@ -405,6 +405,15 @@ $ _DtMessage 12 is the title of the Backdrop dialog box 12 "Fond" +$ Group box for chosing style of backdrop +13 Style de Fond + +$ Styles of backdrop +14 Vignette +15 Centrer +16 Ajuster +17 Remplir + $set 12 Redefine set# $ _DtMessage set 12 is for the Screen dialog diff --git a/cde/programs/localized/it_IT.UTF-8/msg/dtstyle.msg b/cde/programs/localized/it_IT.UTF-8/msg/dtstyle.msg index aaae14dae..86db408ff 100644 --- a/cde/programs/localized/it_IT.UTF-8/msg/dtstyle.msg +++ b/cde/programs/localized/it_IT.UTF-8/msg/dtstyle.msg @@ -377,6 +377,14 @@ file per lo sfondo dello schermo. Controllare il file $HOME/.dt/errorlog. $ _DtMessage 12 is the title of the Backdrop dialog box 12 Gestione degli stili - Sfondo schermo +$ Group box for chosing style of backdrop +13 Stili de Sfondo + +$ Styles of backdrop +14 Affianca +15 Centra +16 Adatta +17 Riempi $set 12 $ _DtMessage set 12 is for the Screen dialog diff --git a/cde/programs/localized/sv_SE.UTF-8/msg/dtstyle.msg b/cde/programs/localized/sv_SE.UTF-8/msg/dtstyle.msg index 7f4a1f409..81fad8169 100644 --- a/cde/programs/localized/sv_SE.UTF-8/msg/dtstyle.msg +++ b/cde/programs/localized/sv_SE.UTF-8/msg/dtstyle.msg @@ -366,6 +366,14 @@ tillgängliga bakgrundsfiler. Kontrollera $HOME/.dt/errorlog. $ _DtMessage 12 is the title of the Backdrop dialog box 12 Arbetsinställningar - Bakgrund +$ Group box for chosing style of backdrop +13 Bakgrundstyp + +$ Styles of backdrop +14 Sida vid sida +15 Center +16 Anpassa +17 Fyll $set 12 $ _DtMessage set 12 is for the Screen dialog