1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 20:38:08 +01:00

- Added xdnd v3 support in WINGs (Sylvain Reynal <sreynal@nerim.net>)

- CVS should compile again
This commit is contained in:
dan
2004-04-07 02:50:52 +00:00
parent 791bb6a444
commit e7d0c5d9e9
23 changed files with 4372 additions and 3734 deletions

View File

@@ -122,6 +122,7 @@ Changes since version 0.80.2:
- Added workaround in global WMWindowAttributes, to avoid creating a second
appicon when a KDE3 application opens a config panel.
- Updated slovak translation (Jan Tomka <judas@linux.sk>)
- Added xdnd v3 support in WINGs (Sylvain Reynal <sreynal@nerim.net>)
Changes since version 0.80.1:

View File

@@ -47,13 +47,14 @@ Changes since wmaker 0.80.1:
- Fixed small memory leak in the font panel code.
- Fixed call to qsort in WMSortArray.
- Fixed a memleak in the file panel.
- Double/triple-click selection in text widgets (Vitaly Ovtchinnikov
<ov@rbcmail.ru>)
- fixed bug in tableview (clicked row callback got incorrect row) (Carlos Torres
<vlaadbrain@operamail.com>)
- Double/triple-click selection in text widgets
(Vitaly Ovtchinnikov <ov@rbcmail.ru>)
- fixed bug in tableview (clicked row callback got incorrect row)
(Carlos Torres <vlaadbrain@operamail.com>)
- Fixed bug in resizing a scrollview
- Fixed bug with wrong text wrapping (Alexey Voinov <voins@voins.program.ru>)
- Added wmkrect()
- Added xdnd v3 support (Sylvain Reynal <sreynal@nerim.net>)
Changes since wmaker 0.80.0:

View File

@@ -27,6 +27,7 @@ libWINGs_a_SOURCES = \
configuration.c \
connection.c \
data.c \
dragcommon.c \
dragdestination.c \
dragsource.c \
error.c \

View File

@@ -16,6 +16,7 @@ wtest_DEPENDENCIES = $(top_builddir)/WINGs/libWINGs.a
EXTRA_DIST = logo.xpm upbtn.xpm wm.html wm.png
INCLUDES = -I$(top_srcdir)/WINGs -I$(top_srcdir)/wrlib -I$(top_srcdir)/src \
-DRESOURCE_PATH=\"$(datadir)/WINGs\" @HEADER_SEARCH_PATH@ -DDEBUG
-DRESOURCE_PATH=\"$(datadir)/WINGs\" @XFTFLAGS@ @HEADER_SEARCH_PATH@ \
-DDEBUG

View File

@@ -609,7 +609,7 @@ testText(WMScreen *scr)
WMFont *font, *ifont;
font = WMDefaultSystemFont(scr);
ifont = WMCopyFontWithChanges(scr, font, WFAEmphasized);
ifont = WMCopyFontWithStyle(scr, font, WFSEmphasized);
if (ifont) {
WMSetTextDefaultFont(text, ifont);
WMReleaseFont(ifont);
@@ -969,275 +969,6 @@ testSplitView(WMScreen *scr)
}
/*******************************************************************/
#include <sys/types.h>
#include <dirent.h>
#include <string.h>
typedef struct {
int x, y;
Bool mouseDown;
char *filename;
} DNDStuff;
WMPixmap*
getImage(WMScreen *scr, char *file)
{
char buffer[1000];
WMPixmap *pix;
sprintf(buffer, "../../WindowMaker/Icons/%s", file);
pix = WMCreatePixmapFromFile(scr, buffer);
return pix;
}
static void
iconMouseStuff(XEvent *event, void *cdata)
{
WMLabel *label = (WMLabel*)cdata;
DNDStuff *stuff = WMGetHangedData(label);
WMPoint where;
switch (event->type) {
case ButtonPress:
stuff->x = event->xbutton.x;
stuff->y = event->xbutton.y;
stuff->mouseDown = True;
break;
case ButtonRelease:
stuff->mouseDown = False;
break;
case MotionNotify:
if (!stuff->mouseDown)
break;
if (abs(stuff->x - event->xmotion.x)>4
|| abs(stuff->y - event->xmotion.y)>4) {
where = WMGetViewScreenPosition(WMWidgetView(label));
WMDragImageFromView(WMWidgetView(label),
WMGetLabelImage(label),
NULL, /* XXX */
where,
wmksize(stuff->x, stuff->y),
event, True);
}
break;
}
}
static void
endedDragImage(WMView *self, WMPixmap *image, WMPoint point, Bool deposited)
{
DNDStuff *stuff = WMGetHangedData(WMWidgetOfView(self));
if (deposited) {
WMDestroyWidget(WMWidgetOfView(self));
}
stuff->mouseDown = False;
}
static WMData*
fetchDragData(WMView *self, char *type)
{
DNDStuff *stuff = WMGetHangedData(WMWidgetOfView(self));
return WMCreateDataWithBytes(stuff->filename, strlen(stuff->filename)+1);
}
WMDragSourceProcs dragSourceProcs = {
NULL,
NULL,
endedDragImage,
fetchDragData
};
/************************/
unsigned
draggingEntered(WMView *self, WMDraggingInfo *info)
{
return WDOperationCopy;
}
unsigned
draggingUpdated(WMView *self, WMDraggingInfo *info)
{
return WDOperationCopy;
}
/*
void (*draggingExited)(WMView *self, WMDraggingInfo *info);
*/
char*
prepareForDragOperation(WMView *self, WMDraggingInfo *info)
{
return "application/X-WINGs-Bla";
}
WMLabel* makeDraggableLabel(WMWidget *w, char *file, int x, int y);
Bool
performDragOperation(WMView *self, WMDraggingInfo *info, WMData *data)
{
char *file = (char*)WMDataBytes(data);
WMPoint pos;
pos = WMGetDraggingInfoImageLocation(info);
if (file!=NULL) {
WMLabel *label;
WMPoint pos2 = WMGetViewScreenPosition(self);
label = makeDraggableLabel(WMWidgetOfView(self), file,
pos.x-pos2.x, pos.y-pos2.y);
WMRealizeWidget(label);
WMMapWidget(label);
}
return True;
}
void
concludeDragOperation(WMView *self, WMDraggingInfo *info)
{
}
WMDragDestinationProcs dragDestProcs = {
draggingEntered,
draggingUpdated,
NULL,
prepareForDragOperation,
performDragOperation,
concludeDragOperation
};
WMLabel*
makeDraggableLabel(WMWidget *w, char *file, int x, int y)
{
DNDStuff *stuff;
WMLabel *label;
WMPixmap *image = getImage(WMWidgetScreen(w), file);
stuff = wmalloc(sizeof(DNDStuff));
stuff->mouseDown = False;
stuff->filename = wstrdup(file);
label = WMCreateLabel(w);
WMResizeWidget(label, 48, 48);
WMMoveWidget(label, x, y);
WMSetViewDragSourceProcs(WMWidgetView(label), &dragSourceProcs);
WMHangData(label, stuff);
WMCreateEventHandler(WMWidgetView(label),
ButtonPressMask|ButtonReleaseMask|ButtonMotionMask,
iconMouseStuff, label);
if (image != NULL) {
WMSetLabelImagePosition(label, WIPImageOnly);
WMSetLabelImage(label, image);
WMReleasePixmap(image);
} else puts(file);
return label;
}
void
testDragAndDrop(WMScreen *scr)
{
WMWindow *win;
WMFrame *frame;
WMLabel *label;
int i, j;
DIR *dir;
struct dirent *ent;
char *types[] = {
"application/X-WINGs-Bla",
NULL
};
windowCount++;
win = WMCreateWindow(scr, "dragDrop");
WMResizeWidget(win, 300, 300);
WMSetWindowCloseAction(win, closeAction, NULL);
WMSetWindowTitle(win, "Drag and Drop");
frame = WMCreateFrame(win);
WMSetFrameRelief(frame, WRSunken);
WMResizeWidget(frame, 250, 250);
WMMoveWidget(frame, 25, 25);
WMRegisterViewForDraggedTypes(WMWidgetView(frame), types);
WMSetViewDragDestinationProcs(WMWidgetView(frame), &dragDestProcs);
dir = opendir("../../WindowMaker/Icons");
if (!dir) {
perror("../../WindowMaker/Icons");
return;
}
for (i = 0, j=0; j < 8; i++) {
ent = readdir(dir);
if (!ent)
break;
if (strstr(ent->d_name, ".xpm")==NULL) {
continue;
}
label = makeDraggableLabel(frame, ent->d_name,4+(j/4)*64, 4+(j%4)*64);
j++;
}
closedir(dir);
WMMapSubwidgets(frame);
WMMapSubwidgets(win);
WMRealizeWidget(win);
WMMapWidget(win);
}
/*******************************************************************/
void
testUD()
{
@@ -1295,7 +1026,10 @@ main(int argc, char **argv)
/*
* Makes the logo be used in standard dialog panels.
*/
WMSetApplicationIconPixmap(scr, pixmap); WMReleasePixmap(pixmap);
if (pixmap) {
WMSetApplicationIconPixmap(scr, pixmap);
WMReleasePixmap(pixmap);
}
/*
* Do some test stuff.
@@ -1303,12 +1037,13 @@ main(int argc, char **argv)
* Put the testSomething() function you want to test here.
*/
testText(scr);
testFontPanel(scr);
testColorPanel(scr);
#if 0
testBox(scr);
testButton(scr);
testColorPanel(scr);

View File

@@ -7,7 +7,7 @@
#include <WINGs/WUtil.h>
#include <X11/Xlib.h>
#define WINGS_H_VERSION 20021124
#define WINGS_H_VERSION 20040406
#ifdef __cplusplus
@@ -223,7 +223,7 @@ enum {
/* drag operations */
typedef enum {
WDOperationNone,
WDOperationNone = 0,
WDOperationCopy,
WDOperationMove,
WDOperationLink,
@@ -427,33 +427,13 @@ typedef struct WMInputPanel {
} WMInputPanel;
#define WFAUnchanged (NULL)
/* Struct for font change operations */
typedef struct WMFontAttributes {
char *foundry;
char *family;
char *weight;
char *slant;
char *setWidth;
char *addStyle;
char *pixelSize;
char *pointSize;
char *resolutionX;
char *resolutionY;
char *spacing;
char *averageWidth;
char *registry;
char *encoding;
} WMFontAttributes;
/* A few useful constant font attributes masks */
extern const WMFontAttributes *WFANormal;
extern const WMFontAttributes *WFABold;
extern const WMFontAttributes *WFANotBold;
extern const WMFontAttributes *WFAEmphasized;
extern const WMFontAttributes *WFANotEmphasized;
extern const WMFontAttributes *WFABoldEmphasized;
/* Basic font styles. Used to easily get one style from another */
typedef enum WMFontStyle {
WFSNormal = 0,
WFSBold = 1,
WFSEmphasized = 2,
WFSBoldEmphasized = 3
} WMFontStyle;
/* WMRuler: */
@@ -480,8 +460,6 @@ typedef void WMAction(WMWidget *self, void *clientData);
typedef void WMAction2(void *self, void *clientData);
typedef void WMDropDataCallback(WMView *view, WMData *data);
/* delegate method like stuff */
typedef void WMListDrawProc(WMList *lPtr, int index, Drawable d, char *text,
int state, WMRect *rect);
@@ -580,11 +558,17 @@ typedef struct WMSelectionProcs {
typedef struct W_DraggingInfo WMDraggingInfo;
/* links a label to a dnd operation. */
typedef struct W_DragOperationtItem WMDragOperationItem;
typedef struct W_DragSourceProcs {
unsigned (*draggingSourceOperation)(WMView *self, Bool local);
void (*beganDragImage)(WMView *self, WMPixmap *image, WMPoint point);
void (*endedDragImage)(WMView *self, WMPixmap *image, WMPoint point,
Bool deposited);
WMArray* (*dropDataTypes)(WMView *self);
WMDragOperationType (*wantedDropOperation)(WMView *self);
WMArray* (*askedOperations)(WMView *self);
Bool (*acceptDropOperation)(WMView *self, WMDragOperationType operation);
void (*beganDrag)(WMView *self, WMPoint *point);
void (*endedDrag)(WMView *self, WMPoint *point, Bool deposited);
WMData* (*fetchDragData)(WMView *self, char *type);
/* Bool (*ignoreModifierKeysWhileDragging)(WMView *view);*/
} WMDragSourceProcs;
@@ -592,16 +576,19 @@ typedef struct W_DragSourceProcs {
typedef struct W_DragDestinationProcs {
unsigned (*draggingEntered)(WMView *self, WMDraggingInfo *info);
unsigned (*draggingUpdated)(WMView *self, WMDraggingInfo *info);
void (*draggingExited)(WMView *self, WMDraggingInfo *info);
Bool (*prepareForDragOperation)(WMView *self, WMDraggingInfo *info);
Bool (*performDragOperation)(WMView *self, WMDraggingInfo *info);
void (*concludeDragOperation)(WMView *self, WMDraggingInfo *info);
void (*prepareForDragOperation)(WMView *self);
WMArray* (*requiredDataTypes)(WMView *self, WMDragOperationType request,
WMArray *sourceDataTypes);
WMDragOperationType (*allowedOperation)(WMView *self,
WMDragOperationType request,
WMArray *sourceDataTypes);
Bool (*inspectDropData)(WMView *self, WMArray *dropData);
void (*performDragOperation)(WMView *self, WMArray *dropData,
WMArray *operations, WMPoint *dropLocation);
void (*concludeDragOperation)(WMView *self);
} WMDragDestinationProcs;
/* ...................................................................... */
@@ -707,24 +694,44 @@ extern char *WMSelectionOwnerDidChangeNotification;
/* ....................................................................... */
WMArray* WMCreateDragOperationArray(int initialSize);
WMDragOperationItem* WMCreateDragOperationItem(WMDragOperationType type,
char* text);
WMDragOperationType WMGetDragOperationItemType(WMDragOperationItem* item);
char* WMGetDragOperationItemText(WMDragOperationItem* item);
void WMSetViewDragImage(WMView* view, WMPixmap *dragImage);
void WMReleaseViewDragImage(WMView* view);
void WMSetViewDragSourceProcs(WMView *view, WMDragSourceProcs *procs);
void WMDragImageFromView(WMView *view, WMPixmap *image, char *dataTypes[],
WMPoint atLocation, WMSize mouseOffset, XEvent *event,
Bool slideBack);
Bool WMIsDraggingFromView(WMView *view);
void WMRegisterViewForDraggedTypes(WMView *view, char *acceptedTypes[]);
void WMDragImageFromView(WMView *view, XEvent *event);
/* Create a drag handler, associating drag event masks with dragEventProc */
void WMCreateDragHandler(WMView *view, WMEventProc *dragEventProc, void *clientData);
void WMDeleteDragHandler(WMView *view, WMEventProc *dragEventProc, void *clientData);
/* set default drag handler for view */
void WMSetViewDraggable(WMView *view, WMDragSourceProcs *procs, WMPixmap *dragImage);
void WMUnsetViewDraggable(WMView *view);
void WMRegisterViewForDraggedTypes(WMView *view, WMArray *acceptedTypes);
void WMUnregisterViewDraggedTypes(WMView *view);
void WMSetViewDragDestinationProcs(WMView *view, WMDragDestinationProcs *procs);
WMPoint WMGetDraggingInfoImageLocation(WMDraggingInfo *info);
/* ....................................................................... */
Bool WMHasAntialiasingSupport(WMScreen *scrPtr);
//Bool WMHasAntialiasingSupport(WMScreen *scrPtr);
Bool WMIsAntialiasingEnabled(WMScreen *scrPtr);
@@ -732,12 +739,7 @@ Bool WMIsAntialiasingEnabled(WMScreen *scrPtr);
WMFont* WMCreateFont(WMScreen *scrPtr, char *fontName);
//??
WMFont* WMCreateFontWithAttributes(WMScreen *scrPtr, char *fontName,
WMFontAttributes *attribs);
WMFont* WMCopyFontWithChanges(WMScreen *scrPtr, WMFont *font,
const WMFontAttributes *changes);
WMFont* WMCopyFontWithStyle(WMScreen *scrPtr, WMFont *font, WMFontStyle style);
WMFont* WMRetainFont(WMFont *font);
@@ -1394,7 +1396,6 @@ char* WMGetPopUpButtonItem(WMPopUpButton *bPtr, int index);
WMMenuItem* WMGetPopUpButtonMenuItem(WMPopUpButton *bPtr, int index);
int WMGetPopUpButtonNumberOfItems(WMPopUpButton *bPtr);
void WMSetPopUpButtonEnabled(WMPopUpButton *bPtr, Bool flag);

View File

@@ -8,7 +8,7 @@
#include <WINGs/WINGs.h>
#if WINGS_H_VERSION < 20021124
#if WINGS_H_VERSION < 20040406
#error There_is_an_old_WINGs.h_file_somewhere_in_your_system._Please_remove_it.
#endif
@@ -97,6 +97,53 @@ typedef struct W_FocusInfo {
typedef void* W_DndState(WMView *destView, XClientMessageEvent *event,
WMDraggingInfo *info);
typedef struct W_DragOperationItem {
WMDragOperationType type;
char* text;
} W_DragOperationItem;
typedef struct W_DragSourceInfo {
WMView *sourceView;
Window destinationWindow;
W_DndState *state;
WMSelectionProcs *selectionProcs;
Window icon;
WMPoint imageLocation;
WMPoint mouseOffset; /* mouse pos in icon */
Cursor dragCursor;
WMRect noPositionMessageZone;
Atom firstThreeTypes[3];
} W_DragSourceInfo;
typedef struct W_DragDestinationInfo {
WMView *destView;
Window sourceWindow;
W_DndState *state;
WMArray *sourceTypes;
WMArray *requiredTypes;
Bool typeListAvailable;
WMArray *dropDatas;
} W_DragDestinationInfo;
struct W_DraggingInfo {
unsigned char protocolVersion;
Time timestamp;
Atom sourceAction;
Atom destinationAction;
W_DragSourceInfo* sourceInfo; /* infos needed by source */
W_DragDestinationInfo* destInfo; /* infos needed by destination */
} W_DraggingInfo;
/* original
struct W_DraggingInfo {
Window destinationWindow;
Window sourceWindow;
@@ -113,12 +160,13 @@ struct W_DraggingInfo {
int protocolVersion;
/* should be treated as internal data */
// should be treated as internal data
WMView *sourceView;
WMView *destView;
WMSize mouseOffset;
unsigned finished:1;
};
*/
typedef struct W_Screen {
@@ -286,6 +334,8 @@ typedef struct W_Screen {
Atom xdndDropAtom;
Atom xdndFinishedAtom;
Atom xdndTypeListAtom;
Atom xdndActionListAtom;
Atom xdndActionDescriptionAtom;
Atom xdndStatusAtom;
Atom xdndActionCopy;
@@ -368,6 +418,7 @@ typedef struct W_View {
Atom *droppableTypes;
struct W_DragSourceProcs *dragSourceProcs;
struct W_DragDestinationProcs *dragDestinationProcs;
WMPixmap *dragImage;
int helpContext;
@@ -383,8 +434,8 @@ typedef struct W_View {
unsigned int dontCompressMotion:1; /* motion notify event compress */
unsigned int notifySizeChanged:1;
unsigned int dontCompressExpose:1; /* will compress all expose
events into one */
unsigned int dontCompressExpose:1; /* expose event compress */
/* toplevel only */
unsigned int worksWhenModal:1;
unsigned int pendingRelease1:1;
@@ -560,6 +611,44 @@ void W_CheckTimerHandlers(void);
Bool W_HandleInputEvents(Bool waitForInput, int inputfd);
/* XDnD */
Atom W_OperationToAction(WMScreen *scr, WMDragOperationType operation);
WMDragOperationType W_ActionToOperation(WMScreen *scr, Atom action);
void W_FreeDragOperationItem(void* item);
Bool W_SendDnDClientMessage(Display *dpy, Window win, Atom message,
unsigned long data1, unsigned long data2,
unsigned long data3, unsigned long data4,
unsigned long data5);
void W_DragSourceStartTimer(WMDraggingInfo *info);
void W_DragSourceStopTimer();
void W_DragSourceStateHandler(WMDraggingInfo *info, XClientMessageEvent *event);
void W_DragDestinationStartTimer(WMDraggingInfo *info);
void W_DragDestinationStopTimer();
void W_DragDestinationStoreEnterMsgInfo(WMDraggingInfo *info, WMView *toplevel,
XClientMessageEvent *event);
void W_DragDestinationStorePositionMsgInfo(WMDraggingInfo *info,
WMView *toplevel,
XClientMessageEvent *event);
void W_DragDestinationCancelDropOnEnter(WMView *toplevel, WMDraggingInfo *info);
void W_DragDestinationStateHandler(WMDraggingInfo *info,
XClientMessageEvent *event);
void W_DragDestinationInfoClear(WMDraggingInfo *info);
void W_FreeViewXdndPart(WMView *view);
#ifdef __cplusplus
}
#endif /* __cplusplus */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -865,7 +865,7 @@ getPropList(PLData *pldata)
break;
case '(':
DPUT("Getting PropList srrsy");
DPUT("Getting PropList array");
plist = getPLArray(pldata);
break;

View File

@@ -4,6 +4,7 @@
#include "WINGsP.h"
#define XDND_COLOR_DATA_TYPE "application/X-color"
char *WMColorWellDidChangeNotification = "WMColorWellDidChangeNotification";
@@ -25,6 +26,8 @@ typedef struct W_ColorWell {
unsigned int active:1;
unsigned int bordered:1;
} flags;
WMArray *xdndTypes;
} ColorWell;
static char *_ColorWellActivatedNotification = "_ColorWellActivatedNotification";
@@ -53,33 +56,36 @@ W_ViewDelegate _ColorWellViewDelegate = {
};
static unsigned draggingSourceOperation(WMView *self, Bool local);
static WMArray* dropDataTypes(WMView *self);
static WMDragOperationType wantedDropOperation(WMView *self);
static Bool acceptDropOperation(WMView *self, WMDragOperationType operation);
static WMData* fetchDragData(WMView *self, char *type);
static WMDragSourceProcs _DragSourceProcs = {
draggingSourceOperation,
dropDataTypes,
wantedDropOperation,
NULL,
acceptDropOperation,
NULL,
NULL,
fetchDragData
};
static unsigned draggingEntered(WMView *self, WMDraggingInfo *info);
static unsigned draggingUpdated(WMView *self, WMDraggingInfo *info);
static void draggingExited(WMView *self, WMDraggingInfo *info);
static char *prepareForDragOperation(WMView *self, WMDraggingInfo *info);
static Bool performDragOperation(WMView *self, WMDraggingInfo *info,
WMData *data);
static void concludeDragOperation(WMView *self, WMDraggingInfo *info);
static WMArray* requiredDataTypes(WMView *self,
WMDragOperationType requestedOperation, WMArray *sourceDataTypes);
static WMDragOperationType allowedOperation(WMView *self,
WMDragOperationType requestedOperation, WMArray *sourceDataTypes);
static void performDragOperation(WMView *self, WMArray *dropDatas,
WMArray *operationsList, WMPoint* dropLocation);
static WMDragDestinationProcs _DragDestinationProcs = {
draggingEntered,
draggingUpdated,
draggingExited,
prepareForDragOperation,
NULL,
requiredDataTypes,
allowedOperation,
NULL,
performDragOperation ,
concludeDragOperation
NULL
};
@@ -141,6 +147,15 @@ activatedObserver(void *data, WMNotification *notification)
static WMArray*
getXdndTypeArray()
{
WMArray *types = WMCreateArray(1);
WMAddToArray(types, XDND_COLOR_DATA_TYPE);
return types;
}
WMColorWell*
WMCreateColorWell(WMWidget *parent)
{
@@ -173,8 +188,7 @@ WMCreateColorWell(WMWidget *parent)
WMCreateEventHandler(cPtr->colorView, ExposureMask, handleEvents, cPtr);
WMCreateEventHandler(cPtr->colorView, ButtonPressMask|ButtonMotionMask
|EnterWindowMask, handleDragEvents, cPtr);
WMCreateDragHandler(cPtr->colorView, handleDragEvents, cPtr);
WMCreateEventHandler(cPtr->view, ButtonPressMask, handleActionEvents,
cPtr);
@@ -196,11 +210,8 @@ WMCreateColorWell(WMWidget *parent)
WMSetViewDragSourceProcs(cPtr->colorView, &_DragSourceProcs);
WMSetViewDragDestinationProcs(cPtr->colorView, &_DragDestinationProcs);
{
char *types[2] = {"application/X-color", NULL};
WMRegisterViewForDraggedTypes(cPtr->colorView, types);
}
cPtr->xdndTypes = getXdndTypeArray();
WMRegisterViewForDraggedTypes(cPtr->colorView, cPtr->xdndTypes);
return cPtr;
}
@@ -308,13 +319,27 @@ handleEvents(XEvent *event, void *data)
}
static unsigned
draggingSourceOperation(WMView *self, Bool local)
static WMArray*
dropDataTypes(WMView *self)
{
return ((ColorWell*)self->self)->xdndTypes;
}
static WMDragOperationType
wantedDropOperation(WMView *self)
{
return WDOperationCopy;
}
static Bool
acceptDropOperation(WMView *self, WMDragOperationType operation)
{
return (operation == WDOperationCopy);
}
static WMData*
fetchDragData(WMView *self, char *type)
{
@@ -322,7 +347,6 @@ fetchDragData(WMView *self, char *type)
WMData *data;
data = WMCreateDataWithBytes(color, strlen(color)+1);
wfree(color);
return data;
@@ -350,36 +374,12 @@ handleDragEvents(XEvent *event, void *data)
{
WMColorWell *cPtr = (ColorWell*)data;
switch (event->type) {
case ButtonPress:
if (event->xbutton.button == Button1) {
cPtr->ipoint.x = event->xbutton.x;
cPtr->ipoint.y = event->xbutton.y;
if (event->type == ButtonPress && event->xbutton.button == Button1) {
/* initialise drag icon */
WMSetViewDragImage(cPtr->colorView, makeDragPixmap(cPtr));
}
break;
case MotionNotify:
if (event->xmotion.state & Button1Mask) {
if (abs(cPtr->ipoint.x - event->xmotion.x) > 4
|| abs(cPtr->ipoint.y - event->xmotion.y) > 4) {
WMSize offs;
WMPixmap *pixmap;
char *types[2] = {"application/X-color", NULL};
offs.width = 2;
offs.height = 2;
pixmap = makeDragPixmap(cPtr);
WMDragImageFromView(cPtr->colorView, pixmap, types,
wmkpoint(event->xmotion.x_root,
event->xmotion.y_root),
offs, event, True);
WMReleasePixmap(pixmap);
}
}
break;
}
WMDragImageFromView(cPtr->colorView, event);
}
@@ -419,56 +419,67 @@ destroyColorWell(ColorWell *cPtr)
if (cPtr->color)
WMReleaseColor(cPtr->color);
WMFreeArray(cPtr->xdndTypes);
wfree(cPtr);
}
static unsigned
draggingEntered(WMView *self, WMDraggingInfo *info)
{
return WDOperationCopy;
}
static unsigned
draggingUpdated(WMView *self, WMDraggingInfo *info)
{
return WDOperationCopy;
}
static void
draggingExited(WMView *self, WMDraggingInfo *info)
{
}
static char*
prepareForDragOperation(WMView *self, WMDraggingInfo *info)
{
return "application/X-color";
}
static Bool
performDragOperation(WMView *self, WMDraggingInfo *info, WMData *data)
dropIsOk(WMDragOperationType request, WMArray *sourceDataTypes)
{
char *colorName = (char*)WMDataBytes(data);
WMColor *color;
color = WMCreateNamedColor(W_VIEW_SCREEN(self), colorName, True);
WMSetColorWellColor(self->self, color);
WMReleaseColor(color);
WMArrayIterator iter;
char *type;
if (request == WDOperationCopy) {
WM_ITERATE_ARRAY(sourceDataTypes, type, iter) {
if (type != NULL && strcmp(type, XDND_COLOR_DATA_TYPE)==0) {
return True;
}
}
}
return False;
}
static WMArray*
requiredDataTypes(WMView *self, WMDragOperationType request, WMArray *sourceDataTypes)
{
if (dropIsOk(request, sourceDataTypes))
return ((ColorWell*)self->self)->xdndTypes;
else
return NULL;
}
static WMDragOperationType
allowedOperation(WMView *self, WMDragOperationType request, WMArray *sourceDataTypes)
{
if (dropIsOk(request, sourceDataTypes))
return WDOperationCopy;
else
return WDOperationNone;
}
static void
concludeDragOperation(WMView *self, WMDraggingInfo *info)
performDragOperation(WMView *self, WMArray *dropData, WMArray *operations,
WMPoint* dropLocation)
{
char *colorName;
WMColor *color;
WMData* data;
/* only one operation requested (WDOperationCopy) implies only one data */
data = (WMData*)WMGetFromArray(dropData, 0);
if (data != NULL) {
colorName = (char*)WMDataBytes(data);
color = WMCreateNamedColor(W_VIEW_SCREEN(self), colorName, True);
WMSetColorWellColor(self->self, color);
WMReleaseColor(color);
}
}

View File

@@ -242,9 +242,6 @@ WMHandleEvent(XEvent *event)
/* handle selection related events */
W_HandleSelectionEvent(event);
} else if (event->type == ClientMessage) {
W_HandleDNDClientMessage(toplevel, &event->xclient);
}
/* if it's a key event, redispatch it to the focused control */
@@ -328,6 +325,11 @@ WMHandleEvent(XEvent *event)
}
}
if (event->type == ClientMessage) {
/* must be handled at the end, for such message can destroy the view */
W_HandleDNDClientMessage(toplevel, &event->xclient);
}
W_ReleaseView(toplevel);
return True;

View File

@@ -149,8 +149,8 @@ alreadyHasStringValue(XftPattern *pattern, const char *object, char *value)
return True;
id = 0;
while ((r=XftPatternGetString(pattern, object, id, &s))!=XftResultNoId) {
if (r == XftResultMatch && strcasecmp(value, s) == 0) {
while ((r=XftPatternGetString(pattern, object, id, &s))==XftResultMatch) {
if (strcasecmp(value, s) == 0) {
return True;
}
id++;
@@ -165,23 +165,21 @@ alreadyHasStringValue(XftPattern *pattern, const char *object, char *value)
static char*
makeFontOfSize(char *font, int size, char *fallback)
{
XftPattern *pattern;
FcPattern *pattern;
char *result;
int len;
len = strlen(font) + 64;
pattern = XftNameParse(font);
XftPatternDel(pattern, "pixelsize");
XftPatternAddDouble(pattern, "pixelsize", (double)size);
if (fallback) {
if (!alreadyHasStringValue(pattern, "family", fallback)) {
len += strlen(fallback);
XftPatternAddString(pattern, "family", fallback);
}
}
result = wmalloc(len);
XftNameUnparse(pattern, result, len);
XftPatternDestroy(pattern);
result = FcNameUnparse(pattern);
FcPatternDestroy(pattern);
return result;
}
@@ -217,7 +215,7 @@ WMCreateFont(WMScreen *scrPtr, char *fontName)
font->screen = scrPtr;
// remove
printf("%s\n", fname);
printf("WMCreateFont: %s\n", fname);
if (fname[0] == '-') {
// Backward compat thing. Remove in a later version
@@ -489,166 +487,50 @@ WMDrawImageString(WMScreen *scr, Drawable d, WMColor *color, WMColor *background
WMFont*
WMCopyFontWithChanges(WMScreen *scrPtr, WMFont *font,
const WMFontAttributes *changes)
WMCopyFontWithStyle(WMScreen *scrPtr, WMFont *font, WMFontStyle style)
{
int index[FONT_PROPS], count[FONT_PROPS];
int totalProps, i, j, carry;
char fname[512];
WMFontFlags fFlags;
WMBag *props;
WMArray *options;
WMFont *result;
char *prop;
snprintf(fname, 512, "%s", font->name);
fFlags = (font->antialiased ? WFAntialiased : WFNotAntialiased);
fFlags |= (font->notFontSet ? WFNormalFont : WFFontSet);
props = WMCreateBagWithDestructor(1, (WMFreeDataProc*)WMFreeArray);
totalProps = 0;
for (i=0; i<FONT_PROPS; i++) {
prop = ((W_FontAttributes*)changes)->props[i];
count[i] = index[i] = 0;
if (!prop) {
/* No change for this property */
continue;
} else if (strchr(prop, ',')==NULL) {
/* Simple option */
changeFontProp(fname, prop, i);
} else {
/* Option with fallback alternatives */
if ((changes==WFAEmphasized || changes==WFABoldEmphasized) &&
font->antialiased && strcmp(prop, "o,i")==0) {
options = getOptions("i,o");
} else {
options = getOptions(prop);
}
WMInsertInBag(props, i, options);
count[i] = WMGetArrayItemCount(options);
if (totalProps==0)
totalProps = 1;
totalProps = totalProps * count[i];
}
}
if (totalProps == 0) {
/* No options with fallback alternatives at all */
WMFreeBag(props);
return WMCreateFontWithFlags(scrPtr, fname, fFlags);
}
for (i=0; i<totalProps; i++) {
for (j=0; j<FONT_PROPS; j++) {
if (count[j]!=0) {
options = WMGetFromBag(props, j);
prop = WMGetFromArray(options, index[j]);
if (prop) {
changeFontProp(fname, prop, j);
}
}
}
result = WMCreateFontWithFlags(scrPtr, fname, fFlags);
if (result) {
WMFreeBag(props);
return result;
}
for (j=FONT_PROPS-1, carry=1; j>=0; j--) {
if (count[j]!=0) {
index[j] += carry;
carry = (index[j]==count[j]);
index[j] %= count[j];
}
}
}
WMFreeBag(props);
FcPattern *pattern;
WMFont *copy;
char *name;
if (!font)
return NULL;
}
#if 0
#define FONT_PROPS 14
typedef struct {
char *props[FONT_PROPS];
} W_FontAttributes;
static void
changeFontProp(char *buf, char *newprop, int position)
{
char buf2[512];
char *ptr, *pptr, *rptr;
int count;
if (buf[0]!='-') {
/* // remove warning later. or maybe not */
wwarning(_("Invalid font specification: '%s'\n"), buf);
return;
}
ptr = pptr = rptr = buf;
count = 0;
while (*ptr && *ptr!=',') {
if (*ptr == '-') {
count++;
if (count-1==position+1) {
rptr = ptr;
pattern = XftNameParse(WMGetFontName(font));
switch (style) {
case WFSNormal:
XftPatternDel(pattern, "weight");
XftPatternDel(pattern, "slant");
XftPatternAddString(pattern, "weight", "medium");
XftPatternAddString(pattern, "slant", "roman");
break;
case WFSBold:
XftPatternDel(pattern, "weight");
XftPatternAddString(pattern, "weight", "bold");
break;
case WFSEmphasized:
XftPatternDel(pattern, "slant");
XftPatternAddString(pattern, "slant", "italic");
XftPatternAddString(pattern, "slant", "oblique");
break;
case WFSBoldEmphasized:
XftPatternDel(pattern, "weight");
XftPatternDel(pattern, "slant");
XftPatternAddString(pattern, "weight", "bold");
XftPatternAddString(pattern, "slant", "italic");
XftPatternAddString(pattern, "slant", "oblique");
break;
}
if (count-1==position) {
pptr = ptr+1;
}
}
ptr++;
}
if (position==FONT_PROPS-1) {
rptr = ptr;
}
*pptr = 0;
snprintf(buf2, 512, "%s%s%s", buf, newprop, rptr);
strcpy(buf, buf2);
name = FcNameUnparse(pattern);
copy = WMCreateFont(scrPtr, name);
FcPatternDestroy(pattern);
wfree(name);
return copy;
}
static WMArray*
getOptions(char *options)
{
char *ptr, *ptr2, *str;
WMArray *result;
int count;
result = WMCreateArrayWithDestructor(2, (WMFreeDataProc*)wfree);
ptr = options;
while (1) {
ptr2 = strchr(ptr, ',');
if (!ptr2) {
WMAddToArray(result, wstrdup(ptr));
break;
} else {
count = ptr2 - ptr;
str = wmalloc(count+1);
memcpy(str, ptr, count);
str[count] = 0;
WMAddToArray(result, str);
ptr = ptr2 + 1;
}
}
return result;
}
#endif
#else /* No XFT support */
@@ -1623,6 +1505,25 @@ getOptions(char *options)
}
#define WFAUnchanged (NULL)
/* Struct for font change operations */
typedef struct WMFontAttributes {
char *foundry;
char *family;
char *weight;
char *slant;
char *setWidth;
char *addStyle;
char *pixelSize;
char *pointSize;
char *resolutionX;
char *resolutionY;
char *spacing;
char *averageWidth;
char *registry;
char *encoding;
} WMFontAttributes;
WMFont*
WMCopyFontWithChanges(WMScreen *scrPtr, WMFont *font,
const WMFontAttributes *changes)
@@ -1704,9 +1605,6 @@ WMCopyFontWithChanges(WMScreen *scrPtr, WMFont *font,
return NULL;
}
#endif
// should WFANormal also set "normal" or leave it alone?
static const WMFontAttributes W_FANormal = {
WFAUnchanged, WFAUnchanged, "medium,normal,regular", "r", "normal",
@@ -1758,3 +1656,6 @@ const WMFontAttributes *WFANotEmphasized = &W_FANotEmphasized;
const WMFontAttributes *WFABoldEmphasized = &W_FABoldEmphasized;
#endif

View File

@@ -579,12 +579,14 @@ WMCreateScreenWithRContext(Display *display, int screen, RContext *context)
"XdndDrop",
"XdndFinished",
"XdndTypeList",
"XdndActionList",
"XdndActionDescription",
"XdndStatus",
"XdndActionCopy",
"XdndActionMove",
"XdndActionLink",
"XdndActionAsk",
"XdndActionPrivate",
"XdndStatus",
"_WINGS_DND_MOUSE_OFFSET",
"WM_STATE"
};
@@ -894,6 +896,8 @@ WMCreateScreenWithRContext(Display *display, int screen, RContext *context)
scrPtr->xdndDropAtom = atoms[i++];
scrPtr->xdndFinishedAtom = atoms[i++];
scrPtr->xdndTypeListAtom = atoms[i++];
scrPtr->xdndActionListAtom = atoms[i++];
scrPtr->xdndActionDescriptionAtom = atoms[i++];
scrPtr->xdndStatusAtom = atoms[i++];
scrPtr->xdndActionCopy = atoms[i++];

View File

@@ -166,6 +166,9 @@ typedef struct W_Text {
unsigned int first:1; /* for plain text parsing, newline? */
/* unsigned int RESERVED:1; */
} flags;
WMArray *xdndSourceTypes;
WMArray *xdndDestinationTypes;
} Text;
@@ -2533,30 +2536,18 @@ handleActionEvents(XEvent *event, void *data)
break;
if ((event->xmotion.state & Button1Mask)) {
TextBlock *tb = tPtr->currentTextBlock;
if(tb && tPtr->flags.isOverGraphic &&
tb->graphic && !tb->object) {
WMSize offs;
WMPixmap *pixmap = tb->d.pixmap;
char *types[2] = {"application/X-image", NULL};
if (WMIsDraggingFromView(tPtr->view)) {
WMDragImageFromView(tPtr->view, event);
break;
}
offs.width = 2;
offs.height = 2;
WMDragImageFromView(tPtr->view, pixmap, types,
wmkpoint(event->xmotion.x_root, event->xmotion.y_root),
offs, event, True);
} else {
if (!tPtr->flags.ownsSelection) {
WMCreateSelectionHandler(tPtr->view,
XA_PRIMARY, event->xbutton.time,
&selectionHandler, NULL);
tPtr->flags.ownsSelection = True;
}
}
selectRegion(tPtr, event->xmotion.x, event->xmotion.y);
break;
}
@@ -2586,9 +2577,9 @@ handleActionEvents(XEvent *event, void *data)
if (event->xbutton.button == Button1) {
TextBlock *tb = tPtr->currentTextBlock;
if(WMIsDoubleClick(event)) {
TextBlock *tb = tPtr->currentTextBlock;
tPtr->lastClickTime = event->xbutton.time;
if(tb && tb->graphic && !tb->object) {
@@ -2615,6 +2606,12 @@ handleActionEvents(XEvent *event, void *data)
if (!tPtr->flags.focused) {
WMSetFocusToWidget(tPtr);
tPtr->flags.focused = True;
} else if (tb && tPtr->flags.isOverGraphic &&
tb->graphic && !tb->object && tb->d.pixmap) {
WMSetViewDragImage(tPtr->view, tb->d.pixmap);
WMDragImageFromView(tPtr->view, event);
break;
}
tPtr->lastClickTime = event->xbutton.time;
@@ -2684,6 +2681,9 @@ handleActionEvents(XEvent *event, void *data)
if (tPtr->flags.waitingForSelection)
break;
if (WMIsDraggingFromView(tPtr->view))
WMDragImageFromView(tPtr->view, event);
}
}
@@ -2763,6 +2763,9 @@ handleEvents(XEvent *event, void *data)
WMDeleteSelectionHandler(tPtr->view, XA_PRIMARY, CurrentTime);
WMRemoveNotificationObserver(tPtr);
WMFreeArray(tPtr->xdndSourceTypes);
WMFreeArray(tPtr->xdndDestinationTypes);
wfree(tPtr);
break;
@@ -2831,12 +2834,28 @@ rulerReleaseCallBack(WMWidget *w, void *self)
return;
}
static unsigned
draggingSourceOperation(WMView *self, Bool local)
static WMArray*
dropDataTypes(WMView *self)
{
return ((Text*)self->self)->xdndSourceTypes;
}
static WMDragOperationType
wantedDropOperation(WMView *self)
{
return WDOperationCopy;
}
static Bool
acceptDropOperation(WMView *self, WMDragOperationType allowedOperation)
{
return (allowedOperation == WDOperationCopy);
}
static WMData*
fetchDragData(WMView *self, char *type)
{
@@ -2844,10 +2863,10 @@ fetchDragData(WMView *self, char *type)
char *desc;
WMData *data;
if (strcmp(type, "text/plain")) {
if (!tb)
return NULL;
printf("type is [%s]\n", type);
desc = wmalloc(tb->used+1);
memcpy(desc, tb->text, tb->used);
desc[tb->used] = 0;
@@ -2858,123 +2877,69 @@ printf("type is [%s]\n", type);
return data;
}
return NULL;
}
static WMDragSourceProcs _DragSourceProcs = {
draggingSourceOperation,
dropDataTypes,
wantedDropOperation,
NULL,
acceptDropOperation,
NULL,
NULL,
fetchDragData
};
static unsigned
draggingEntered(WMView *self, WMDraggingInfo *info)
static WMArray*
requiredDataTypes(WMView *self, WMDragOperationType request, WMArray *sourceDataTypes)
{
printf("draggingEntered\n");
return WDOperationCopy;
return ((Text*)self->self)->xdndDestinationTypes;
}
static unsigned
draggingUpdated(WMView *self, WMDraggingInfo *info)
static WMDragOperationType
allowedOperation(WMView *self, WMDragOperationType request, WMArray *sourceDataTypes)
{
return WDOperationCopy;
}
static void
draggingExited(WMView *self, WMDraggingInfo *info)
performDragOperation(WMView *self, WMArray *dropData, WMArray *operations,
WMPoint* dropLocation)
{
printf("draggingExited\n");
}
static Bool
prepareForDragOperation(WMView *self, WMDraggingInfo *info)
{
printf("prepareForDragOperation\n");
return True;
}
char *badbadbad;
static void
receivedData(WMView *view, Atom selection, Atom target, Time timestamp,
void *cdata, WMData *data)
{
badbadbad = wstrdup((char *)WMDataBytes(data));
}
/* when it's done in WINGs, remove this */
Bool
requestDroppedData(WMView *view, WMDraggingInfo *info, char *type)
{
WMScreen *scr = W_VIEW_SCREEN(view);
if (!WMRequestSelection(scr->dragInfo.destView,
scr->xdndSelectionAtom,
XInternAtom(scr->display, type, False),
scr->dragInfo.timestamp,
receivedData, &scr->dragInfo)) {
wwarning("could not request data for dropped data");
}
{
XEvent ev;
ev.type = ClientMessage;
ev.xclient.message_type = scr->xdndFinishedAtom;
ev.xclient.format = 32;
ev.xclient.window = info->destinationWindow;
ev.xclient.data.l[0] = 0;
ev.xclient.data.l[1] = 0;
ev.xclient.data.l[2] = 0;
ev.xclient.data.l[3] = 0;
ev.xclient.data.l[4] = 0;
XSendEvent(scr->display, info->sourceWindow, False, 0, &ev);
XFlush(scr->display);
}
return True;
}
static Bool
performDragOperation(WMView *self, WMDraggingInfo *info)
{
WMColor *color;
WMText *tPtr = (WMText *)self->self;
WMData* data;
char* colorName;
WMColor *color;
if (!tPtr)
return True;
if (tPtr) {
/* only one required type, implies only one drop data */
/* get application/X-color if any */
data = (WMData*)WMPopFromArray(dropData);
if (data != NULL) {
colorName = (char*)WMDataBytes(data);
color = WMCreateNamedColor(W_VIEW_SCREEN(self), colorName, True);
requestDroppedData(tPtr->view, info, "application/X-color");
color = WMCreateNamedColor(W_VIEW_SCREEN(self), badbadbad, True);
if(color) {
WMSetTextSelectionColor(tPtr, color);
WMReleaseColor(color);
}
return True;
}
static void
concludeDragOperation(WMView *self, WMDraggingInfo *info)
{
printf("concludeDragOperation\n");
}
}
static WMDragDestinationProcs _DragDestinationProcs = {
draggingEntered,
draggingUpdated,
draggingExited,
prepareForDragOperation,
NULL,
requiredDataTypes,
allowedOperation,
NULL,
performDragOperation,
concludeDragOperation
NULL
};
@@ -3106,6 +3071,26 @@ getStreamObjects(WMText *tPtr, int sel)
}
#define XDND_TEXT_DATA_TYPE "text/plain"
#define XDND_COLOR_DATA_TYPE "application/X-color"
static WMArray*
getXdndSourceTypeArray()
{
WMArray *types = WMCreateArray(1);
WMAddToArray(types, XDND_TEXT_DATA_TYPE);
return types;
}
static WMArray*
getXdndDestinationTypeArray()
{
WMArray *types = WMCreateArray(1);
WMAddToArray(types, XDND_COLOR_DATA_TYPE);
return types;
}
WMText*
WMCreateTextForDocumentType(WMWidget *parent, WMAction *parser, WMAction *writer)
{
@@ -3179,7 +3164,9 @@ WMCreateTextForDocumentType(WMWidget *parent, WMAction *parser, WMAction *writer
{
char *types[3] = {"application/X-color", "application/X-image", NULL};
WMArray *types = WMCreateArray(2);
WMAddToArray(types, "application/X-color");
WMAddToArray(types, "application/X-image");
WMRegisterViewForDraggedTypes(tPtr->view, types);
}
@@ -3242,6 +3229,9 @@ WMCreateTextForDocumentType(WMWidget *parent, WMAction *parser, WMAction *writer
tPtr->flags.alignment = WALeft;
tPtr->flags.first = True;
tPtr->xdndSourceTypes = getXdndSourceTypeArray();
tPtr->xdndDestinationTypes = getXdndDestinationTypeArray();
return tPtr;
}

View File

@@ -445,21 +445,10 @@ destroyView(W_View *view)
WMFreeArray(view->eventHandlers);
view->eventHandlers = NULL;
WMUnregisterViewDraggedTypes(view);
WMRemoveNotificationObserver(view);
#if 0
if (view->dragSourceProcs)
wfree(view->dragSourceProcs);
W_FreeViewXdndPart(view);
if (view->dragDestinationProcs)
wfree(view->dragDestinationProcs);
if (scr->dragInfo.destView == view) {
scr->dragInfo.destView = NULL;
}
#endif
wfree(view);
}

View File

@@ -54,7 +54,7 @@ showData(_Panel *panel)
WMSetButtonSelected(panel->swi[4], GetBoolForKey("WindozeCycling"));
WMSetButtonSelected(panel->swi[5], GetBoolForKey("DontConfirmKill"));
WMSetButtonSelected(panel->swi[6], GetBoolForKey("DisableBlinking"));
if (WMHasAntialiasingSupport(WMWidgetScreen(panel->box)))
//if (WMHasAntialiasingSupport(WMWidgetScreen(panel->box)))
WMSetButtonSelected(panel->swi[7], GetBoolForKey("AntialiasedText"));
}
@@ -83,7 +83,7 @@ createPanel(Panel *p)
WMSetButtonText(panel->swi[6], _("Disable selection animation for selected icons."));
WMSetButtonText(panel->swi[7], _("Smooth font edges (needs restart)."));
if (!WMHasAntialiasingSupport(WMWidgetScreen(panel->box)))
//if (!WMHasAntialiasingSupport(WMWidgetScreen(panel->box)))
WMSetButtonEnabled(panel->swi[7], False);
WMRealizeWidget(panel->box);
@@ -107,7 +107,7 @@ storeDefaults(_Panel *panel)
SetBoolForKey(WMGetButtonSelected(panel->swi[4]), "WindozeCycling");
SetBoolForKey(WMGetButtonSelected(panel->swi[5]), "DontConfirmKill");
SetBoolForKey(WMGetButtonSelected(panel->swi[6]), "DisableBlinking");
if (WMHasAntialiasingSupport(WMWidgetScreen(panel->box)))
//if (WMHasAntialiasingSupport(WMWidgetScreen(panel->box)))
SetBoolForKey(WMGetButtonSelected(panel->swi[7]), "AntialiasedText");
}

View File

@@ -1284,16 +1284,16 @@ getFontForPreview(void *data, int element)
WMScreen *scr = WMWidgetScreen(panel->box);
char *encoding = getFontEncoding(panel);
fname = fontOfLang(panel, encoding, element);
if (WMHasAntialiasingSupport(scr))
{
//if (WMHasAntialiasingSupport(scr)) {
if(panel->AntialiasedText) {
font = WMCreateFontWithFlags(scr, fname, WFAntialiased);
} else {
font = WMCreateFont(scr, fname);
}
// fix this -Dan font = WMCreateFontWithFlags(scr, fname, WFAntialiased);
font = WMCreateFont(scr, fname);
} else {
font = WMCreateFont(scr, fname);
}
//} else {
// font = WMCreateFont(scr, fname);
//}
if(!font) {
char *msg;
int length;
@@ -1822,8 +1822,7 @@ showData(_Panel *panel)
/* gotta check for Antialiasing AFTER MultiByte incase the use has both
* to maintain behavior in Current Fonts set or i could add another if
* statement to setLanguageType =) */
if (WMHasAntialiasingSupport(scr))
{
//if (WMHasAntialiasingSupport(scr)) {
WMMapWidget(panel->togAA);
if(GetBoolForKey("AntialiasedText")){
WMSetButtonSelected(panel->togAA, True);
@@ -1832,9 +1831,9 @@ showData(_Panel *panel)
WMSetButtonSelected(panel->togAA, False);
panel->AntialiasedText = False;
}
} else {
WMUnmapWidget(panel->togAA);
}
//} else {
// WMUnmapWidget(panel->togAA);
//}
paintPreviewBox(panel, EVERYTHING);
@@ -1909,8 +1908,7 @@ createPanel(Panel *p)
WMMapSubwidgets(panel->langF);
/* Antialiasing */
if (WMHasAntialiasingSupport(scr))
{
//if (WMHasAntialiasingSupport(scr)) {
panel->togAA = WMCreateSwitchButton(panel->box);
WMResizeWidget(panel->togAA, 110, 20);
WMMoveWidget(panel->togAA, 155, 10);
@@ -1919,7 +1917,7 @@ createPanel(Panel *p)
"requires a restart after saving"),
WMWidgetView(panel->togAA));
WMSetButtonAction(panel->togAA, toggleAA, panel);
}
//}
/* multibyte */
panel->fsetL = WMCreateLabel(panel->box);
WMResizeWidget(panel->fsetL, 245, 20);
@@ -2063,7 +2061,7 @@ storeData(Panel *p)
}
}
if (WMHasAntialiasingSupport(WMWidgetScreen(panel->box)))
//if (WMHasAntialiasingSupport(WMWidgetScreen(panel->box)))
SetBoolForKey(WMGetButtonSelected(panel->togAA), "AntialiasedText");
if(panel->MultiByteText)

View File

@@ -15,7 +15,7 @@ AC_INIT(src/WindowMaker.h)
AM_INIT_AUTOMAKE(WindowMaker, 0.81.0)
AM_INIT_AUTOMAKE(WindowMaker, 0.90.0)
AC_PROG_LIBTOOL
@@ -102,8 +102,8 @@ AC_FUNC_VPRINTF
AC_FUNC_ALLOCA
AC_CHECK_FUNCS(gethostname select poll strerror strcasecmp strncasecmp \
setsid atexit mallinfo mkstemp snprintf vsnprintf asprintf \
vasprintf mbsnrtowcs mbsrtowcs mbrtowc mbrlen)
vasprintf mbsnrtowcs mbsrtowcs mbrtowc mbrlen wcsnrtombs \
wcsrtombs wcstombs)
dnl ripped from samba
dnl

View File

@@ -1312,7 +1312,8 @@ wShowInfoPanel(WScreen *scr)
WMSetLabelTextAlignment(panel->copyrL, WALeft);
WMSetLabelText(panel->copyrL, COPYRIGHT_TEXT);
/* we want the (c) character in the font, so don't use a FontSet here */
font = WMCreateFontWithFlags(scr->wmscreen, "SystemFont-11", WFNormalFont);
// fix this -Dan font = WMCreateFontWithFlags(scr->wmscreen, "SystemFont-11", WFNormalFont);
font = WMSystemFontOfSize(scr->wmscreen, 11);
if (font) {
WMSetLabelFont(panel->copyrL, font);
WMReleaseFont(font);

View File

@@ -821,9 +821,11 @@ wScreenInit(int screen_number)
scr->info_text_font = WMBoldSystemFontOfSize(scr->wmscreen, 12);
scr->tech_draw_font = WMCreateFontWithFlags(scr->wmscreen,
"BoldSystemFont-12",
WFNotAntialiased);
// fix this too -Dan
//scr->tech_draw_font = WMCreateFontWithFlags(scr->wmscreen,
// "BoldSystemFont-12",
// WFNotAntialiased);
scr->tech_draw_font = WMBoldSystemFontOfSize(scr->wmscreen, 12);
scr->gview = WCreateGeometryView(scr->wmscreen);
WMRealizeWidget(scr->gview);