1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00

Allow the window manager to handle centered, fit and fill backdrops

This commit is contained in:
Peter Howkins 2022-06-11 22:45:53 +01:00 committed by Jon Trulson
parent 8e09e4be73
commit 1f5ec7f034
21 changed files with 430 additions and 23 deletions

View file

@ -436,6 +436,41 @@ AC_CHECK_LIB(Xinerama, XineramaQueryScreens,
[SOURCE_CPP_DEFINES="${SOURCE_CPP_DEFINES} -DUSE_XINERAMA"], [SOURCE_CPP_DEFINES="${SOURCE_CPP_DEFINES} -DUSE_XINERAMA"],
[AC_MSG_ERROR([libXinerama not found])], $X_LIBS) [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 <X11/Xlib.h>
])
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... dnl Special check for tirpc...
AC_CHECK_LIB(tirpc, svc_register, AC_CHECK_LIB(tirpc, svc_register,
[CFLAGS="${CFLAGS} -DOPT_TIRPC -I/usr/include/tirpc"; [CFLAGS="${CFLAGS} -DOPT_TIRPC -I/usr/include/tirpc";

View file

@ -52,10 +52,19 @@ extern "C" {
#define DtWSM_REASON_CURRENT 4 #define DtWSM_REASON_CURRENT 4
/* /*
* Types * 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 */ /* Workspace property information */
typedef struct _DtWsmWorkspaceInfo { typedef struct _DtWsmWorkspaceInfo {
@ -67,6 +76,7 @@ typedef struct _DtWsmWorkspaceInfo {
char *pchTitle; char *pchTitle;
Window *backdropWindows; Window *backdropWindows;
int numBackdropWindows; int numBackdropWindows;
DtWsmBackdropImageType imageType; /**< Tiled, Center, Fit, Fill */
} DtWsmWorkspaceInfo; } DtWsmWorkspaceInfo;

View file

@ -447,7 +447,7 @@ _DtWmRestart(
/*************************************<->************************************* /*************************************<->*************************************
* *
* int _DtWsmChangeBackdrop (display, root, path, pixmap) * int _DtWsmChangeBackdrop (display, root, path, pixmap, imageType)
* *
* *
* Description: * Description:
@ -461,6 +461,7 @@ _DtWmRestart(
* root - root window of screen * root - root window of screen
* path - file path to bitmap file * path - file path to bitmap file
* pixmap - pixmap id of backdrop pixmap * pixmap - pixmap id of backdrop pixmap
* imageType - Style of backdrop, tiled, center, fit or fill
* *
* Returns: * Returns:
* -------- * --------
@ -472,7 +473,8 @@ _DtWsmChangeBackdrop (
Display *display, Display *display,
Window root, Window root,
char *path, char *path,
Pixmap pixmap); Pixmap pixmap,
DtWsmBackdropImageType imageType);
/*************************************<->************************************* /*************************************<->*************************************
* *

View file

@ -86,13 +86,13 @@ DtWsmChangeBackdrop (
char *path, char *path,
Pixmap pixmap) 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: * Description:
@ -106,6 +106,7 @@ DtWsmChangeBackdrop (
* root - root window of screen * root - root window of screen
* path - file path to bitmap file * path - file path to bitmap file
* pixmap - pixmap id of backdrop pixmap * pixmap - pixmap id of backdrop pixmap
* imageType - Style of backdrop, tiled, center, fit or fill
* *
* Returns: * Returns:
* -------- * --------
@ -120,7 +121,8 @@ _DtWsmChangeBackdrop (
Display *display, Display *display,
Window root, Window root,
char *path, char *path,
Pixmap pixmap) Pixmap pixmap,
DtWsmBackdropImageType imageType)
{ {
int rval = BadAtom; int rval = BadAtom;
Window wmWindow; Window wmWindow;
@ -147,8 +149,8 @@ _DtWsmChangeBackdrop (
pch = (char *) XtMalloc (len * sizeof(char)); pch = (char *) XtMalloc (len * sizeof(char));
sprintf (pch, "%s %s %lx", DTWM_REQ_CHANGE_BACKDROP, path, sprintf (pch, "%s %s %lx %d", DTWM_REQ_CHANGE_BACKDROP, path,
pixmap); pixmap, imageType);
/* /*
* Make the request by appending the string to * Make the request by appending the string to

View file

@ -184,6 +184,13 @@ DtWsmGetWorkspaceInfo(
item++; item++;
} }
/* imageType */
if (item < count)
{
pWsInfo->imageType = atoi (ppchList[item]);
item++;
}
/* number of backdrop windows */ /* number of backdrop windows */
if (item < count) if (item < count)
{ {

View file

@ -64,6 +64,8 @@
#include <Xm/List.h> #include <Xm/List.h>
#include <Xm/VendorSEP.h> #include <Xm/VendorSEP.h>
#include <Xm/AtomMgr.h> #include <Xm/AtomMgr.h>
#include <Xm/RowColumn.h>
#include <Xm/ToggleBG.h>
#include <Dt/DialogBox.h> #include <Dt/DialogBox.h>
@ -73,6 +75,7 @@
#include <Dt/Wsm.h> #include <Dt/Wsm.h>
#include <Dt/UserMsg.h> #include <Dt/UserMsg.h>
#include <Dt/WsmP.h> #include <Dt/WsmP.h>
#include <Dt/TitleBox.h>
#include "Help.h" #include "Help.h"
#include "Main.h" #include "Main.h"
@ -138,6 +141,14 @@ static void _DtMapCB(
typedef struct { typedef struct {
Widget drawnButton; Widget drawnButton;
Widget imageStyleTB;
Widget imageTypeRC;
Widget tiledTG;
Widget centeredTG;
#if defined(USE_XRENDER)
Widget fitTG;
Widget fillTG;
#endif /* USE_XRENDER */
char **dirList; char **dirList;
int dirCount; int dirCount;
char **tmpBitmapNames; 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 *) backdropName);
XtFree((char *) wInfo); XtFree((char *) wInfo);
} }
@ -342,6 +371,8 @@ CreateBackdropDialog(
XmString *listStrings; XmString *listStrings;
char *bd_desc; char *bd_desc;
char *lang; char *lang;
XmString string;
Widget imageStyleForm;
if (backdrops.noBitmaps) if (backdrops.noBitmaps)
@ -472,6 +503,58 @@ CreateBackdropDialog(
XtSetArg (args[n], XmNallowOverlap, False); n++; XtSetArg (args[n], XmNallowOverlap, False); n++;
mainForm = XmCreateForm (style.backdropDialog, "backdropsForm", args, 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 */ /* create the scrolled list of bitmap names... first create XmStrings */
listStrings = MakeListStrings (); listStrings = MakeListStrings ();
n = 0; n = 0;
@ -486,7 +569,8 @@ CreateBackdropDialog(
/* set up attachments for scrolled list itself */ /* set up attachments for scrolled list itself */
n = 0; n = 0;
XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++; 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++; XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
XtSetValues (XtParent(list), args, n); XtSetValues (XtParent(list), args, n);
@ -512,6 +596,15 @@ CreateBackdropDialog(
XtManageChild (mainForm); XtManageChild (mainForm);
XtManageChild (backdrops.drawnButton); XtManageChild (backdrops.drawnButton);
XtManageChild (list); 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; return 1;
} }
@ -974,9 +1067,24 @@ ButtonCB(
{ {
int n, num; int n, num;
Arg args[MAX_ARGS]; Arg args[MAX_ARGS];
DtWsmBackdropImageType imageType;
DtDialogBoxCallbackStruct *cb = (DtDialogBoxCallbackStruct *) call_data; 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) switch (cb->button_position)
{ {
case B_APPLY_BUTTON: case B_APPLY_BUTTON:
@ -986,7 +1094,8 @@ ButtonCB(
_DtWsmChangeBackdrop(style.display, style.root, _DtWsmChangeBackdrop(style.display, style.root,
backdrops.bitmapNames[num], backdrops.bitmapNames[num],
backdrops.bitmaps[num]); backdrops.bitmaps[num],
imageType);
break; break;
case B_OK_BUTTON: case B_OK_BUTTON:
@ -996,7 +1105,8 @@ ButtonCB(
_DtWsmChangeBackdrop(style.display, style.root, _DtWsmChangeBackdrop(style.display, style.root,
backdrops.bitmapNames[num], backdrops.bitmapNames[num],
backdrops.bitmaps[num]); backdrops.bitmaps[num],
imageType);
XtUnmanageChild(w); XtUnmanageChild(w);
break; break;

View file

@ -381,6 +381,14 @@ files available. Check $HOME/.dt/errorlog.
$ _DtMessage 12 is the title of the Backdrop dialog box $ _DtMessage 12 is the title of the Backdrop dialog box
12 Style Manager - Backdrop 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 $set 12
$ _DtMessage set 12 is for the Screen dialog $ _DtMessage set 12 is for the Screen dialog

View file

@ -31,6 +31,12 @@
#define BOTTOM 0 #define BOTTOM 0
#define CHANGE_BACKDROP (1L << 0) #define CHANGE_BACKDROP (1L << 0)
#if defined(USE_XRENDER)
#include <X11/extensions/Xrender.h>
#endif /* USE_XRENDER */
#include <Dt/UserMsg.h>
#include "WmGlobal.h" #include "WmGlobal.h"
#include "WmResource.h" #include "WmResource.h"
#include "WmResNames.h" #include "WmResNames.h"
@ -294,13 +300,137 @@ ProcessBackdropResources(
XGetGeometry( XGetGeometry(
display, tmpPix, display, tmpPix,
&win, &x, &y, &w, &h, &bw, &depth); &win, &x, &y, &w, &h, &bw, &depth);
gc = XCreateGC(display, tmpPix, 0, NULL);
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 = pWS->backdrop.imagePixmap =
XCreatePixmap(display, tmpPix, w, h, depth); XCreatePixmap(display, tmpPix, w, h, depth);
gc = XCreateGC(display, tmpPix, 0, NULL);
status = XCopyArea( status = XCopyArea(
XtDisplay(pWS->workspaceTopLevelW), XtDisplay(pWS->workspaceTopLevelW),
tmpPix, pWS->backdrop.imagePixmap, gc, tmpPix, pWS->backdrop.imagePixmap, gc,
0, 0, w, h, 0, 0); 0, 0, w, h, 0, 0);
}
XFreeGC(display, gc); XFreeGC(display, gc);
} }
@ -541,7 +671,7 @@ FullBitmapFilePath(
/******************************<->************************************* /******************************<->*************************************
* *
* SetNewBackdrop (pWS, pixmap, aName) * SetNewBackdrop (pWS, pixmap, aName, imageType)
* *
* Description: * Description:
* ----------- * -----------
@ -552,6 +682,7 @@ FullBitmapFilePath(
* pWS = pointer to workspace data * pWS = pointer to workspace data
* pixmap = pixmap for the backdrop (if any) * pixmap = pixmap for the backdrop (if any)
* aName = atomized name for the backdrop (either file name or "none") * aName = atomized name for the backdrop (either file name or "none")
* imageType = Style of backdrop, tiled, center, fit or fill
* *
* Outputs: * Outputs:
* ------- * -------
@ -566,7 +697,8 @@ void
SetNewBackdrop( SetNewBackdrop(
WmWorkspaceData *pWS, WmWorkspaceData *pWS,
Pixmap pixmap, Pixmap pixmap,
String bitmapFile ) String bitmapFile,
DtWsmBackdropImageType imageType )
{ {
String pchNewBitmap = NULL; String pchNewBitmap = NULL;
@ -604,6 +736,7 @@ SetNewBackdrop(
pWS->backdrop.imagePixmap = pixmap; pWS->backdrop.imagePixmap = pixmap;
pWS->backdrop.image = pchNewBitmap; pWS->backdrop.image = pchNewBitmap;
pWS->backdrop.imageType = imageType;
ProcessBackdropResources (pWS, CHANGE_BACKDROP); ProcessBackdropResources (pWS, CHANGE_BACKDROP);
@ -614,6 +747,7 @@ SetNewBackdrop(
ChangeBackdrop (pWS); ChangeBackdrop (pWS);
SaveWorkspaceResources (pWS, WM_RES_BACKDROP_IMAGE); SaveWorkspaceResources (pWS, WM_RES_BACKDROP_IMAGE);
SaveWorkspaceResources (pWS, WM_RES_BACKDROP_IMAGETYPE);
SetWorkspaceInfoProperty (pWS); SetWorkspaceInfoProperty (pWS);

View file

@ -38,7 +38,8 @@ extern String FullBitmapFilePath(
extern void SetNewBackdrop( extern void SetNewBackdrop(
WmWorkspaceData *pWS, WmWorkspaceData *pWS,
Pixmap pixmap, Pixmap pixmap,
String bitmapFile) ; String bitmapFile,
DtWsmBackdropImageType imageType) ;
extern Boolean IsBackdropWindow( extern Boolean IsBackdropWindow(
WmScreenData *pSD, WmScreenData *pSD,
Window win) ; Window win) ;

View file

@ -63,6 +63,7 @@
#include "WmResParse.h" #include "WmResParse.h"
#include "WmParse.h" #include "WmParse.h"
#include "WmParseP.h" #include "WmParseP.h"
#include "Dt/Wsm.h"
#include <Xm/RowColumnP.h> /* for MS_LastManagedMenuTime */ #include <Xm/RowColumnP.h> /* for MS_LastManagedMenuTime */
extern XmMenuState _XmGetMenuState(); extern XmMenuState _XmGetMenuState();
@ -1998,6 +1999,7 @@ HandleDtWmRequest (WmScreenData *pSD, XEvent *pev)
strlen(DTWM_REQ_CHANGE_BACKDROP))) strlen(DTWM_REQ_CHANGE_BACKDROP)))
{ {
Pixmap pixmap = None; Pixmap pixmap = None;
DtWsmBackdropImageType imageType = DtWSM_BACKDROP_IMAGETYPE_TILED;
char *pch; char *pch;
char *pchFile = NULL; char *pchFile = NULL;
@ -2025,7 +2027,18 @@ HandleDtWmRequest (WmScreenData *pSD, XEvent *pev)
if (pch) if (pch)
{ {
sscanf (pch, "%lx", &pixmap); 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 else
{ {

View file

@ -331,6 +331,7 @@ extern Pixel FPselectcolor;
#define WM_RES_FP_POSITION (1L << 4) #define WM_RES_FP_POSITION (1L << 4)
#define WM_RES_ICONBOX_GEOMETRY (1L << 5) #define WM_RES_ICONBOX_GEOMETRY (1L << 5)
#define WM_RES_WORKSPACE_COUNT (1L << 6) #define WM_RES_WORKSPACE_COUNT (1L << 6)
#define WM_RES_BACKDROP_IMAGETYPE (1L << 7)
@ -1352,6 +1353,7 @@ typedef struct _WmBackdropData
int colorSet; /* resource */ int colorSet; /* resource */
Pixel background; /* resource */ Pixel background; /* resource */
Pixel foreground; /* resource */ Pixel foreground; /* resource */
DtWsmBackdropImageType imageType; /* resource */
unsigned int flags; unsigned int flags;
Window window; Window window;
} BackdropData; } BackdropData;

View file

@ -1322,7 +1322,7 @@ SetWorkspaceInfoProperty (WmWorkspaceData *pWS)
* number of backdrop windows * number of backdrop windows
* list 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 */ count = 1; /* number of backdrop windows */
iNumStrings += count; iNumStrings += count;
@ -1356,6 +1356,11 @@ SetWorkspaceInfoProperty (WmWorkspaceData *pWS)
sprintf (&pch[ix], "0x%lx", pWS->backdrop.nameAtom); sprintf (&pch[ix], "0x%lx", pWS->backdrop.nameAtom);
ppchList[i++] = &pch[ix]; 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 */ /* number of backdrop windows */
ix = (i * WIP_NUMBER_SIZE); ix = (i * WIP_NUMBER_SIZE);
if (pWS->backdrop.window == None) if (pWS->backdrop.window == None)

View file

@ -91,6 +91,7 @@
#define WmNimage "image" #define WmNimage "image"
#define WmNimageBackground "imageBackground" #define WmNimageBackground "imageBackground"
#define WmNimageForeground "imageForeground" #define WmNimageForeground "imageForeground"
#define WmNimageType "imageType"
#define WmNinteractivePlacement "interactivePlacement" #define WmNinteractivePlacement "interactivePlacement"
#define WmNkeyBindings "keyBindings" #define WmNkeyBindings "keyBindings"
#define WmNkeyboardFocusPolicy "keyboardFocusPolicy" #define WmNkeyboardFocusPolicy "keyboardFocusPolicy"
@ -252,6 +253,7 @@
#define WmCImage "Image" #define WmCImage "Image"
#define WmCImageBackground "ImageBackground" #define WmCImageBackground "ImageBackground"
#define WmCImageForeground "ImageForeground" #define WmCImageForeground "ImageForeground"
#define WmCImageType "ImageType"
#define WmCInteractivePlacement "InteractivePlacement" #define WmCInteractivePlacement "InteractivePlacement"
#define WmCKeyBindings "KeyBindings" #define WmCKeyBindings "KeyBindings"
#define WmCKeyboardFocusPolicy "KeyboardFocusPolicy" #define WmCKeyboardFocusPolicy "KeyboardFocusPolicy"

View file

@ -1620,6 +1620,16 @@ XtResource wmBackdropResources[] =
(XtPointer)NULL (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, WmNbackdrop, WmCBackdrop, wmBackdropResources,
XtNumber (wmBackdropResources), NULL, 0); XtNumber (wmBackdropResources), NULL, 0);
/* This call will create the backdrop windows of the correct size */
ProcessBackdropResources (pWS, 0); 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 */ } /* END OF FUNCTION ProcessWorkspaceResources */

View file

@ -3443,6 +3443,25 @@ SaveWorkspaceResources(
AddStringToResourceData (buffer, &data, &cum_len); 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) if (flags & WM_RES_WORKSPACE_TITLE)
{ {

View file

@ -189,7 +189,7 @@ $ YOU DON'T NEED TO LOCALIZE THIS SET.
2 Insufficient memory to handle backdrop change. 2 Insufficient memory to handle backdrop change.
3 Missing path name for backdrop change request. 3 Missing path name for backdrop change request.
4 Missing pixmap id for backdrop change request. 4 Missing pixmap id for backdrop change request.
5 Missing backdrop image style number for backdrop change request.
$set 34 $set 34
$ THIS COMMENT FOR DTWM TEAM ONLY -- WmIPlace.c -- $ THIS COMMENT FOR DTWM TEAM ONLY -- WmIPlace.c --

View file

@ -408,6 +408,15 @@ $ _DtMessage 12 is the title of the Backdrop dialog box
12 "Umgebungsverwaltung - Hintergrund" 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# $set 12 Redefine set#
$ _DtMessage set 12 is for the Screen dialog $ _DtMessage set 12 is for the Screen dialog

View file

@ -404,6 +404,15 @@ $ _DtMessage 12 is the title of the Backdrop dialog box
12 "Gestor de estilos - Fondo" 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# $set 12 Redefine set#
$ _DtMessage set 12 is for the Screen dialog $ _DtMessage set 12 is for the Screen dialog

View file

@ -405,6 +405,15 @@ $ _DtMessage 12 is the title of the Backdrop dialog box
12 "Fond" 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# $set 12 Redefine set#
$ _DtMessage set 12 is for the Screen dialog $ _DtMessage set 12 is for the Screen dialog

View file

@ -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 $ _DtMessage 12 is the title of the Backdrop dialog box
12 Gestione degli stili - Sfondo schermo 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 $set 12
$ _DtMessage set 12 is for the Screen dialog $ _DtMessage set 12 is for the Screen dialog

View file

@ -366,6 +366,14 @@ tillgängliga bakgrundsfiler. Kontrollera $HOME/.dt/errorlog.
$ _DtMessage 12 is the title of the Backdrop dialog box $ _DtMessage 12 is the title of the Backdrop dialog box
12 Arbetsinställningar - Bakgrund 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 $set 12
$ _DtMessage set 12 is for the Screen dialog $ _DtMessage set 12 is for the Screen dialog