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:
@@ -122,6 +122,7 @@ Changes since version 0.80.2:
|
|||||||
- Added workaround in global WMWindowAttributes, to avoid creating a second
|
- Added workaround in global WMWindowAttributes, to avoid creating a second
|
||||||
appicon when a KDE3 application opens a config panel.
|
appicon when a KDE3 application opens a config panel.
|
||||||
- Updated slovak translation (Jan Tomka <judas@linux.sk>)
|
- 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:
|
Changes since version 0.80.1:
|
||||||
|
|||||||
@@ -47,13 +47,14 @@ Changes since wmaker 0.80.1:
|
|||||||
- Fixed small memory leak in the font panel code.
|
- Fixed small memory leak in the font panel code.
|
||||||
- Fixed call to qsort in WMSortArray.
|
- Fixed call to qsort in WMSortArray.
|
||||||
- Fixed a memleak in the file panel.
|
- Fixed a memleak in the file panel.
|
||||||
- Double/triple-click selection in text widgets (Vitaly Ovtchinnikov
|
- Double/triple-click selection in text widgets
|
||||||
<ov@rbcmail.ru>)
|
(Vitaly Ovtchinnikov <ov@rbcmail.ru>)
|
||||||
- fixed bug in tableview (clicked row callback got incorrect row) (Carlos Torres
|
- fixed bug in tableview (clicked row callback got incorrect row)
|
||||||
<vlaadbrain@operamail.com>)
|
(Carlos Torres <vlaadbrain@operamail.com>)
|
||||||
- Fixed bug in resizing a scrollview
|
- Fixed bug in resizing a scrollview
|
||||||
- Fixed bug with wrong text wrapping (Alexey Voinov <voins@voins.program.ru>)
|
- Fixed bug with wrong text wrapping (Alexey Voinov <voins@voins.program.ru>)
|
||||||
- Added wmkrect()
|
- Added wmkrect()
|
||||||
|
- Added xdnd v3 support (Sylvain Reynal <sreynal@nerim.net>)
|
||||||
|
|
||||||
|
|
||||||
Changes since wmaker 0.80.0:
|
Changes since wmaker 0.80.0:
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ libWINGs_a_SOURCES = \
|
|||||||
configuration.c \
|
configuration.c \
|
||||||
connection.c \
|
connection.c \
|
||||||
data.c \
|
data.c \
|
||||||
|
dragcommon.c \
|
||||||
dragdestination.c \
|
dragdestination.c \
|
||||||
dragsource.c \
|
dragsource.c \
|
||||||
error.c \
|
error.c \
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ wtest_DEPENDENCIES = $(top_builddir)/WINGs/libWINGs.a
|
|||||||
EXTRA_DIST = logo.xpm upbtn.xpm wm.html wm.png
|
EXTRA_DIST = logo.xpm upbtn.xpm wm.html wm.png
|
||||||
|
|
||||||
INCLUDES = -I$(top_srcdir)/WINGs -I$(top_srcdir)/wrlib -I$(top_srcdir)/src \
|
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
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -28,13 +28,13 @@ Display *dpy;
|
|||||||
int windowCount = 0;
|
int windowCount = 0;
|
||||||
|
|
||||||
void
|
void
|
||||||
closeAction(WMWidget *self, void *data)
|
closeAction(WMWidget *self, void *data)
|
||||||
{
|
{
|
||||||
WMDestroyWidget(self);
|
WMDestroyWidget(self);
|
||||||
windowCount--;
|
windowCount--;
|
||||||
printf("window closed, window count = %d\n", windowCount);
|
printf("window closed, window count = %d\n", windowCount);
|
||||||
if (windowCount < 1)
|
if (windowCount < 1)
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -66,7 +66,7 @@ testFontPanel(WMScreen *scr)
|
|||||||
|
|
||||||
WMShowFontPanel(panel);
|
WMShowFontPanel(panel);
|
||||||
|
|
||||||
/* WMFreeFontPanel(panel);*/
|
/*WMFreeFontPanel(panel);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -78,15 +78,15 @@ testFrame(WMScreen *scr)
|
|||||||
WMFrame *frame;
|
WMFrame *frame;
|
||||||
int i;
|
int i;
|
||||||
static char* titles[] = {
|
static char* titles[] = {
|
||||||
"AboveTop",
|
"AboveTop",
|
||||||
"AtTop",
|
"AtTop",
|
||||||
"BelowTop",
|
"BelowTop",
|
||||||
"AboveBottom",
|
"AboveBottom",
|
||||||
"AtBottom",
|
"AtBottom",
|
||||||
"BelowBottom"
|
"BelowBottom"
|
||||||
};
|
};
|
||||||
static WMTitlePosition pos[] = {
|
static WMTitlePosition pos[] = {
|
||||||
WTPAboveTop,
|
WTPAboveTop,
|
||||||
WTPAtTop,
|
WTPAtTop,
|
||||||
WTPBelowTop,
|
WTPBelowTop,
|
||||||
WTPAboveBottom,
|
WTPAboveBottom,
|
||||||
@@ -102,11 +102,11 @@ testFrame(WMScreen *scr)
|
|||||||
WMResizeWidget(win, 400, 300);
|
WMResizeWidget(win, 400, 300);
|
||||||
|
|
||||||
for (i = 0; i < 6; i++) {
|
for (i = 0; i < 6; i++) {
|
||||||
frame = WMCreateFrame(win);
|
frame = WMCreateFrame(win);
|
||||||
WMMoveWidget(frame, 8+(i%3)*130, 8+(i/3)*130);
|
WMMoveWidget(frame, 8+(i%3)*130, 8+(i/3)*130);
|
||||||
WMResizeWidget(frame, 120, 120);
|
WMResizeWidget(frame, 120, 120);
|
||||||
WMSetFrameTitle(frame, titles[i]);
|
WMSetFrameTitle(frame, titles[i]);
|
||||||
WMSetFrameTitlePosition(frame, pos[i]);
|
WMSetFrameTitlePosition(frame, pos[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
WMRealizeWidget(win);
|
WMRealizeWidget(win);
|
||||||
@@ -147,31 +147,31 @@ testBox(WMScreen *scr)
|
|||||||
|
|
||||||
/*WMSetBoxHorizontal(box, True);*/
|
/*WMSetBoxHorizontal(box, True);*/
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
btn = WMCreateCommandButton(box);
|
btn = WMCreateCommandButton(box);
|
||||||
WMSetButtonText(btn, "bla");
|
WMSetButtonText(btn, "bla");
|
||||||
WMMapWidget(btn);
|
WMMapWidget(btn);
|
||||||
WMAddBoxSubview(box, WMWidgetView(btn), i&1, True, 20, 0, 5);
|
WMAddBoxSubview(box, WMWidgetView(btn), i&1, True, 20, 0, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
pop = WMCreatePopUpButton(box);
|
pop = WMCreatePopUpButton(box);
|
||||||
WMAddPopUpButtonItem(pop, "ewqeq");
|
WMAddPopUpButtonItem(pop, "ewqeq");
|
||||||
WMAddPopUpButtonItem(pop, "ewqeqrewrw");
|
WMAddPopUpButtonItem(pop, "ewqeqrewrw");
|
||||||
WMAddBoxSubview(box, WMWidgetView(pop), False, True, 20, 0, 5);
|
WMAddBoxSubview(box, WMWidgetView(pop), False, True, 20, 0, 5);
|
||||||
WMMapWidget(pop);
|
WMMapWidget(pop);
|
||||||
|
|
||||||
hbox = WMCreateBox(box);
|
hbox = WMCreateBox(box);
|
||||||
WMSetBoxHorizontal(hbox, True);
|
WMSetBoxHorizontal(hbox, True);
|
||||||
WMAddBoxSubview(box, WMWidgetView(hbox), False, True, 24, 0, 0);
|
WMAddBoxSubview(box, WMWidgetView(hbox), False, True, 24, 0, 0);
|
||||||
WMMapWidget(hbox);
|
WMMapWidget(hbox);
|
||||||
|
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
btn = WMCreateCommandButton(hbox);
|
btn = WMCreateCommandButton(hbox);
|
||||||
WMSetButtonText(btn, "bla");
|
WMSetButtonText(btn, "bla");
|
||||||
WMMapWidget(btn);
|
WMMapWidget(btn);
|
||||||
WMAddBoxSubview(hbox, WMWidgetView(btn), 1, True, 60, 0, i<3?5:0);
|
WMAddBoxSubview(hbox, WMWidgetView(btn), 1, True, 60, 0, i<3?5:0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WMRealizeWidget(win);
|
WMRealizeWidget(win);
|
||||||
WMMapSubwidgets(win);
|
WMMapSubwidgets(win);
|
||||||
WMMapWidget(win);
|
WMMapWidget(win);
|
||||||
@@ -242,16 +242,16 @@ testList(WMScreen *scr)
|
|||||||
/*WMSetListAllowEmptySelection(list, True);*/
|
/*WMSetListAllowEmptySelection(list, True);*/
|
||||||
WMMoveWidget(list, 10, 40);
|
WMMoveWidget(list, 10, 40);
|
||||||
for (i=0; i<105; i++) {
|
for (i=0; i<105; i++) {
|
||||||
sprintf(text, "Item %i", i);
|
sprintf(text, "Item %i", i);
|
||||||
WMAddListItem(list, text);
|
WMAddListItem(list, text);
|
||||||
}
|
}
|
||||||
mlist = WMCreateList(win);
|
mlist = WMCreateList(win);
|
||||||
WMSetListAllowMultipleSelection(mlist, True);
|
WMSetListAllowMultipleSelection(mlist, True);
|
||||||
/*WMSetListAllowEmptySelection(mlist, True);*/
|
/*WMSetListAllowEmptySelection(mlist, True);*/
|
||||||
WMMoveWidget(mlist, 210, 40);
|
WMMoveWidget(mlist, 210, 40);
|
||||||
for (i=0; i<135; i++) {
|
for (i=0; i<135; i++) {
|
||||||
sprintf(text, "Item %i", i);
|
sprintf(text, "Item %i", i);
|
||||||
WMAddListItem(mlist, text);
|
WMAddListItem(mlist, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
label = WMCreateLabel(win);
|
label = WMCreateLabel(win);
|
||||||
@@ -272,9 +272,9 @@ testList(WMScreen *scr)
|
|||||||
WMSetListDoubleAction(mlist, doubleClick, mlabel);
|
WMSetListDoubleAction(mlist, doubleClick, mlabel);
|
||||||
|
|
||||||
WMAddNotificationObserver(listSelectionObserver, label,
|
WMAddNotificationObserver(listSelectionObserver, label,
|
||||||
WMListSelectionDidChangeNotification, list);
|
WMListSelectionDidChangeNotification, list);
|
||||||
WMAddNotificationObserver(listSelectionObserver, mlabel,
|
WMAddNotificationObserver(listSelectionObserver, mlabel,
|
||||||
WMListSelectionDidChangeNotification, mlist);
|
WMListSelectionDidChangeNotification, mlist);
|
||||||
|
|
||||||
|
|
||||||
WMRealizeWidget(win);
|
WMRealizeWidget(win);
|
||||||
@@ -289,14 +289,14 @@ testButton(WMScreen *scr)
|
|||||||
WMWindow *win;
|
WMWindow *win;
|
||||||
int i;
|
int i;
|
||||||
char *types[] = {
|
char *types[] = {
|
||||||
"MomentaryPush",
|
"MomentaryPush",
|
||||||
"PushOnPushOff",
|
"PushOnPushOff",
|
||||||
"Toggle",
|
"Toggle",
|
||||||
"Switch",
|
"Switch",
|
||||||
"Radio",
|
"Radio",
|
||||||
"MomentaryChange",
|
"MomentaryChange",
|
||||||
"OnOff",
|
"OnOff",
|
||||||
"MomentaryLigh"
|
"MomentaryLigh"
|
||||||
};
|
};
|
||||||
|
|
||||||
windowCount++;
|
windowCount++;
|
||||||
@@ -308,11 +308,11 @@ testButton(WMScreen *scr)
|
|||||||
WMSetWindowCloseAction(win, closeAction, NULL);
|
WMSetWindowCloseAction(win, closeAction, NULL);
|
||||||
|
|
||||||
for (i = 1; i < 9; i++) {
|
for (i = 1; i < 9; i++) {
|
||||||
WMButton *b;
|
WMButton *b;
|
||||||
b = WMCreateButton(win, i);
|
b = WMCreateButton(win, i);
|
||||||
WMResizeWidget(b, 150, 24);
|
WMResizeWidget(b, 150, 24);
|
||||||
WMMoveWidget(b, 20, i*30);
|
WMMoveWidget(b, 20, i*30);
|
||||||
WMSetButtonText(b, types[i-1]);
|
WMSetButtonText(b, types[i-1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
WMRealizeWidget(win);
|
WMRealizeWidget(win);
|
||||||
@@ -404,7 +404,7 @@ testGradientButtons(WMScreen *scr)
|
|||||||
WMSetButtonTextColor(btn, color);
|
WMSetButtonTextColor(btn, color);
|
||||||
|
|
||||||
WMSetBalloonTextForView("This is yet another button.\nBut the balloon has 3 lines.\nYay!",
|
WMSetBalloonTextForView("This is yet another button.\nBut the balloon has 3 lines.\nYay!",
|
||||||
WMWidgetView(btn));
|
WMWidgetView(btn));
|
||||||
|
|
||||||
WMReleaseColor(color);
|
WMReleaseColor(color);
|
||||||
WMReleaseColor(altColor);
|
WMReleaseColor(altColor);
|
||||||
@@ -450,12 +450,12 @@ testScrollView(WMScreen *scr)
|
|||||||
WMSetFrameRelief(f, WRFlat);
|
WMSetFrameRelief(f, WRFlat);
|
||||||
|
|
||||||
for (i=0; i<20; i++) {
|
for (i=0; i<20; i++) {
|
||||||
l = WMCreateLabel(f);
|
l = WMCreateLabel(f);
|
||||||
WMResizeWidget(l, 50, 18);
|
WMResizeWidget(l, 50, 18);
|
||||||
WMMoveWidget(l, 10, 20*i);
|
WMMoveWidget(l, 10, 20*i);
|
||||||
sprintf(buffer, "Label %i", i);
|
sprintf(buffer, "Label %i", i);
|
||||||
WMSetLabelText(l, buffer);
|
WMSetLabelText(l, buffer);
|
||||||
WMSetLabelRelief(l, WRSimple);
|
WMSetLabelRelief(l, WRSimple);
|
||||||
}
|
}
|
||||||
WMMapSubwidgets(f);
|
WMMapSubwidgets(f);
|
||||||
WMMapWidget(f);
|
WMMapWidget(f);
|
||||||
@@ -509,10 +509,10 @@ testColorPanel(WMScreen *scr)
|
|||||||
WMColorPanel *panel = WMGetColorPanel(scr);
|
WMColorPanel *panel = WMGetColorPanel(scr);
|
||||||
|
|
||||||
/*if (colorname) {
|
/*if (colorname) {
|
||||||
startcolor = WMCreateNamedColor(scr, colorname, False);
|
startcolor = WMCreateNamedColor(scr, colorname, False);
|
||||||
WMSetColorPanelColor(panel, startcolor);
|
WMSetColorPanelColor(panel, startcolor);
|
||||||
WMReleaseColor(startcolor);
|
WMReleaseColor(startcolor);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
WMShowColorPanel(panel);
|
WMShowColorPanel(panel);
|
||||||
}
|
}
|
||||||
@@ -609,7 +609,7 @@ testText(WMScreen *scr)
|
|||||||
WMFont *font, *ifont;
|
WMFont *font, *ifont;
|
||||||
|
|
||||||
font = WMDefaultSystemFont(scr);
|
font = WMDefaultSystemFont(scr);
|
||||||
ifont = WMCopyFontWithChanges(scr, font, WFAEmphasized);
|
ifont = WMCopyFontWithStyle(scr, font, WFSEmphasized);
|
||||||
if (ifont) {
|
if (ifont) {
|
||||||
WMSetTextDefaultFont(text, ifont);
|
WMSetTextDefaultFont(text, ifont);
|
||||||
WMReleaseFont(ifont);
|
WMReleaseFont(ifont);
|
||||||
@@ -804,21 +804,21 @@ testTabView(WMScreen *scr)
|
|||||||
|
|
||||||
void
|
void
|
||||||
splitViewConstrainProc(WMSplitView *sPtr, int indView,
|
splitViewConstrainProc(WMSplitView *sPtr, int indView,
|
||||||
int *minSize, int *maxSize)
|
int *minSize, int *maxSize)
|
||||||
{
|
{
|
||||||
switch (indView) {
|
switch (indView) {
|
||||||
case 0:
|
case 0:
|
||||||
*minSize = 20;
|
*minSize = 20;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
*minSize = 40;
|
*minSize = 40;
|
||||||
*maxSize = 80;
|
*maxSize = 80;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
*maxSize = 60;
|
*maxSize = 60;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -829,14 +829,14 @@ resizeSplitView(XEvent *event, void *data)
|
|||||||
WMSplitView *sPtr = (WMSplitView*)data;
|
WMSplitView *sPtr = (WMSplitView*)data;
|
||||||
|
|
||||||
if (event->type == ConfigureNotify) {
|
if (event->type == ConfigureNotify) {
|
||||||
int width = event->xconfigure.width - 10;
|
int width = event->xconfigure.width - 10;
|
||||||
|
|
||||||
if (width < WMGetSplitViewDividerThickness(sPtr))
|
if (width < WMGetSplitViewDividerThickness(sPtr))
|
||||||
width = WMGetSplitViewDividerThickness(sPtr);
|
width = WMGetSplitViewDividerThickness(sPtr);
|
||||||
|
|
||||||
if (width != WMWidgetWidth(sPtr) ||
|
if (width != WMWidgetWidth(sPtr) ||
|
||||||
event->xconfigure.height != WMWidgetHeight(sPtr))
|
event->xconfigure.height != WMWidgetHeight(sPtr))
|
||||||
WMResizeWidget(sPtr, width, event->xconfigure.height - 55);
|
WMResizeWidget(sPtr, width, event->xconfigure.height - 55);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -862,9 +862,9 @@ removeSubviewButtonAction(WMWidget *self, void *data)
|
|||||||
int count = WMGetSplitViewSubviewsCount(sPtr);
|
int count = WMGetSplitViewSubviewsCount(sPtr);
|
||||||
|
|
||||||
if (count > 2) {
|
if (count > 2) {
|
||||||
WMView *view = WMGetSplitViewSubviewAt(sPtr, count-1);
|
WMView *view = WMGetSplitViewSubviewAt(sPtr, count-1);
|
||||||
WMDestroyWidget(WMWidgetOfView(view));
|
WMDestroyWidget(WMWidgetOfView(view));
|
||||||
WMRemoveSplitViewSubviewAt(sPtr, count-1);
|
WMRemoveSplitViewSubviewAt(sPtr, count-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -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
|
void
|
||||||
testUD()
|
testUD()
|
||||||
{
|
{
|
||||||
@@ -1271,8 +1002,8 @@ main(int argc, char **argv)
|
|||||||
dpy = XOpenDisplay("");
|
dpy = XOpenDisplay("");
|
||||||
|
|
||||||
if (!dpy) {
|
if (!dpy) {
|
||||||
puts("could not open display");
|
puts("could not open display");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is used to disable buffering of X protocol requests.
|
/* This is used to disable buffering of X protocol requests.
|
||||||
@@ -1295,7 +1026,10 @@ main(int argc, char **argv)
|
|||||||
/*
|
/*
|
||||||
* Makes the logo be used in standard dialog panels.
|
* 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.
|
* Do some test stuff.
|
||||||
@@ -1303,12 +1037,13 @@ main(int argc, char **argv)
|
|||||||
* Put the testSomething() function you want to test here.
|
* Put the testSomething() function you want to test here.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
testText(scr);
|
testText(scr);
|
||||||
testFontPanel(scr);
|
testFontPanel(scr);
|
||||||
|
|
||||||
|
testColorPanel(scr);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
testBox(scr);
|
testBox(scr);
|
||||||
testButton(scr);
|
testButton(scr);
|
||||||
testColorPanel(scr);
|
testColorPanel(scr);
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
#include <WINGs/WUtil.h>
|
#include <WINGs/WUtil.h>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
|
||||||
#define WINGS_H_VERSION 20021124
|
#define WINGS_H_VERSION 20040406
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@@ -223,7 +223,7 @@ enum {
|
|||||||
|
|
||||||
/* drag operations */
|
/* drag operations */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
WDOperationNone,
|
WDOperationNone = 0,
|
||||||
WDOperationCopy,
|
WDOperationCopy,
|
||||||
WDOperationMove,
|
WDOperationMove,
|
||||||
WDOperationLink,
|
WDOperationLink,
|
||||||
@@ -427,33 +427,13 @@ typedef struct WMInputPanel {
|
|||||||
} WMInputPanel;
|
} WMInputPanel;
|
||||||
|
|
||||||
|
|
||||||
|
/* Basic font styles. Used to easily get one style from another */
|
||||||
#define WFAUnchanged (NULL)
|
typedef enum WMFontStyle {
|
||||||
/* Struct for font change operations */
|
WFSNormal = 0,
|
||||||
typedef struct WMFontAttributes {
|
WFSBold = 1,
|
||||||
char *foundry;
|
WFSEmphasized = 2,
|
||||||
char *family;
|
WFSBoldEmphasized = 3
|
||||||
char *weight;
|
} WMFontStyle;
|
||||||
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;
|
|
||||||
|
|
||||||
|
|
||||||
/* WMRuler: */
|
/* WMRuler: */
|
||||||
@@ -480,11 +460,9 @@ typedef void WMAction(WMWidget *self, void *clientData);
|
|||||||
typedef void WMAction2(void *self, void *clientData);
|
typedef void WMAction2(void *self, void *clientData);
|
||||||
|
|
||||||
|
|
||||||
typedef void WMDropDataCallback(WMView *view, WMData *data);
|
|
||||||
|
|
||||||
/* delegate method like stuff */
|
/* delegate method like stuff */
|
||||||
typedef void WMListDrawProc(WMList *lPtr, int index, Drawable d, char *text,
|
typedef void WMListDrawProc(WMList *lPtr, int index, Drawable d, char *text,
|
||||||
int state, WMRect *rect);
|
int state, WMRect *rect);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
typedef void WMSplitViewResizeSubviewsProc(WMSplitView *sPtr,
|
typedef void WMSplitViewResizeSubviewsProc(WMSplitView *sPtr,
|
||||||
@@ -493,7 +471,7 @@ typedef void WMSplitViewResizeSubviewsProc(WMSplitView *sPtr,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
typedef void WMSplitViewConstrainProc(WMSplitView *sPtr, int dividerIndex,
|
typedef void WMSplitViewConstrainProc(WMSplitView *sPtr, int dividerIndex,
|
||||||
int *minSize, int *maxSize);
|
int *minSize, int *maxSize);
|
||||||
|
|
||||||
typedef WMWidget* WMMatrixCreateCellProc(WMMatrix *mPtr);
|
typedef WMWidget* WMMatrixCreateCellProc(WMMatrix *mPtr);
|
||||||
|
|
||||||
@@ -504,10 +482,10 @@ typedef struct WMBrowserDelegate {
|
|||||||
void *data;
|
void *data;
|
||||||
|
|
||||||
void (*createRowsForColumn)(struct WMBrowserDelegate *self,
|
void (*createRowsForColumn)(struct WMBrowserDelegate *self,
|
||||||
WMBrowser *sender, int column, WMList *list);
|
WMBrowser *sender, int column, WMList *list);
|
||||||
|
|
||||||
char* (*titleOfColumn)(struct WMBrowserDelegate *self, WMBrowser *sender,
|
char* (*titleOfColumn)(struct WMBrowserDelegate *self, WMBrowser *sender,
|
||||||
int column);
|
int column);
|
||||||
|
|
||||||
void (*didScroll)(struct WMBrowserDelegate *self, WMBrowser *sender);
|
void (*didScroll)(struct WMBrowserDelegate *self, WMBrowser *sender);
|
||||||
|
|
||||||
@@ -539,7 +517,7 @@ typedef struct WMTextDelegate {
|
|||||||
void *data;
|
void *data;
|
||||||
|
|
||||||
Bool (*didDoubleClickOnPicture)(struct WMTextDelegate *self,
|
Bool (*didDoubleClickOnPicture)(struct WMTextDelegate *self,
|
||||||
void *description);
|
void *description);
|
||||||
|
|
||||||
} WMTextDelegate;
|
} WMTextDelegate;
|
||||||
|
|
||||||
@@ -549,7 +527,7 @@ typedef struct WMTabViewDelegate {
|
|||||||
void *data;
|
void *data;
|
||||||
|
|
||||||
void (*didChangeNumberOfItems)(struct WMTabViewDelegate *self,
|
void (*didChangeNumberOfItems)(struct WMTabViewDelegate *self,
|
||||||
WMTabView *tabView);
|
WMTabView *tabView);
|
||||||
|
|
||||||
void (*didSelectItem)(struct WMTabViewDelegate *self, WMTabView *tabView,
|
void (*didSelectItem)(struct WMTabViewDelegate *self, WMTabView *tabView,
|
||||||
WMTabViewItem *item);
|
WMTabViewItem *item);
|
||||||
@@ -565,26 +543,32 @@ typedef struct WMTabViewDelegate {
|
|||||||
|
|
||||||
|
|
||||||
typedef void WMSelectionCallback(WMView *view, Atom selection, Atom target,
|
typedef void WMSelectionCallback(WMView *view, Atom selection, Atom target,
|
||||||
Time timestamp, void *cdata, WMData *data);
|
Time timestamp, void *cdata, WMData *data);
|
||||||
|
|
||||||
|
|
||||||
typedef struct WMSelectionProcs {
|
typedef struct WMSelectionProcs {
|
||||||
WMData* (*convertSelection)(WMView *view, Atom selection, Atom target,
|
WMData* (*convertSelection)(WMView *view, Atom selection, Atom target,
|
||||||
void *cdata, Atom *type);
|
void *cdata, Atom *type);
|
||||||
void (*selectionLost)(WMView *view, Atom selection, void *cdata);
|
void (*selectionLost)(WMView *view, Atom selection, void *cdata);
|
||||||
void (*selectionDone)(WMView *view, Atom selection, Atom target,
|
void (*selectionDone)(WMView *view, Atom selection, Atom target,
|
||||||
void *cdata);
|
void *cdata);
|
||||||
} WMSelectionProcs;
|
} WMSelectionProcs;
|
||||||
|
|
||||||
|
|
||||||
typedef struct W_DraggingInfo WMDraggingInfo;
|
typedef struct W_DraggingInfo WMDraggingInfo;
|
||||||
|
|
||||||
|
|
||||||
|
/* links a label to a dnd operation. */
|
||||||
|
typedef struct W_DragOperationtItem WMDragOperationItem;
|
||||||
|
|
||||||
|
|
||||||
typedef struct W_DragSourceProcs {
|
typedef struct W_DragSourceProcs {
|
||||||
unsigned (*draggingSourceOperation)(WMView *self, Bool local);
|
WMArray* (*dropDataTypes)(WMView *self);
|
||||||
void (*beganDragImage)(WMView *self, WMPixmap *image, WMPoint point);
|
WMDragOperationType (*wantedDropOperation)(WMView *self);
|
||||||
void (*endedDragImage)(WMView *self, WMPixmap *image, WMPoint point,
|
WMArray* (*askedOperations)(WMView *self);
|
||||||
Bool deposited);
|
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);
|
WMData* (*fetchDragData)(WMView *self, char *type);
|
||||||
/* Bool (*ignoreModifierKeysWhileDragging)(WMView *view);*/
|
/* Bool (*ignoreModifierKeysWhileDragging)(WMView *view);*/
|
||||||
} WMDragSourceProcs;
|
} WMDragSourceProcs;
|
||||||
@@ -592,16 +576,19 @@ typedef struct W_DragSourceProcs {
|
|||||||
|
|
||||||
|
|
||||||
typedef struct W_DragDestinationProcs {
|
typedef struct W_DragDestinationProcs {
|
||||||
unsigned (*draggingEntered)(WMView *self, WMDraggingInfo *info);
|
void (*prepareForDragOperation)(WMView *self);
|
||||||
unsigned (*draggingUpdated)(WMView *self, WMDraggingInfo *info);
|
WMArray* (*requiredDataTypes)(WMView *self, WMDragOperationType request,
|
||||||
void (*draggingExited)(WMView *self, WMDraggingInfo *info);
|
WMArray *sourceDataTypes);
|
||||||
Bool (*prepareForDragOperation)(WMView *self, WMDraggingInfo *info);
|
WMDragOperationType (*allowedOperation)(WMView *self,
|
||||||
Bool (*performDragOperation)(WMView *self, WMDraggingInfo *info);
|
WMDragOperationType request,
|
||||||
void (*concludeDragOperation)(WMView *self, WMDraggingInfo *info);
|
WMArray *sourceDataTypes);
|
||||||
|
Bool (*inspectDropData)(WMView *self, WMArray *dropData);
|
||||||
|
void (*performDragOperation)(WMView *self, WMArray *dropData,
|
||||||
|
WMArray *operations, WMPoint *dropLocation);
|
||||||
|
void (*concludeDragOperation)(WMView *self);
|
||||||
} WMDragDestinationProcs;
|
} 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 WMSetViewDragSourceProcs(WMView *view, WMDragSourceProcs *procs);
|
||||||
|
|
||||||
void WMDragImageFromView(WMView *view, WMPixmap *image, char *dataTypes[],
|
Bool WMIsDraggingFromView(WMView *view);
|
||||||
WMPoint atLocation, WMSize mouseOffset, XEvent *event,
|
|
||||||
Bool slideBack);
|
|
||||||
|
|
||||||
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 WMUnregisterViewDraggedTypes(WMView *view);
|
||||||
|
|
||||||
void WMSetViewDragDestinationProcs(WMView *view, WMDragDestinationProcs *procs);
|
void WMSetViewDragDestinationProcs(WMView *view, WMDragDestinationProcs *procs);
|
||||||
|
|
||||||
|
|
||||||
WMPoint WMGetDraggingInfoImageLocation(WMDraggingInfo *info);
|
|
||||||
|
|
||||||
/* ....................................................................... */
|
/* ....................................................................... */
|
||||||
|
|
||||||
Bool WMHasAntialiasingSupport(WMScreen *scrPtr);
|
//Bool WMHasAntialiasingSupport(WMScreen *scrPtr);
|
||||||
|
|
||||||
Bool WMIsAntialiasingEnabled(WMScreen *scrPtr);
|
Bool WMIsAntialiasingEnabled(WMScreen *scrPtr);
|
||||||
|
|
||||||
@@ -732,12 +739,7 @@ Bool WMIsAntialiasingEnabled(WMScreen *scrPtr);
|
|||||||
|
|
||||||
WMFont* WMCreateFont(WMScreen *scrPtr, char *fontName);
|
WMFont* WMCreateFont(WMScreen *scrPtr, char *fontName);
|
||||||
|
|
||||||
//??
|
WMFont* WMCopyFontWithStyle(WMScreen *scrPtr, WMFont *font, WMFontStyle style);
|
||||||
WMFont* WMCreateFontWithAttributes(WMScreen *scrPtr, char *fontName,
|
|
||||||
WMFontAttributes *attribs);
|
|
||||||
|
|
||||||
WMFont* WMCopyFontWithChanges(WMScreen *scrPtr, WMFont *font,
|
|
||||||
const WMFontAttributes *changes);
|
|
||||||
|
|
||||||
WMFont* WMRetainFont(WMFont *font);
|
WMFont* WMRetainFont(WMFont *font);
|
||||||
|
|
||||||
@@ -766,14 +768,14 @@ WMPixmap* WMRetainPixmap(WMPixmap *pixmap);
|
|||||||
void WMReleasePixmap(WMPixmap *pixmap);
|
void WMReleasePixmap(WMPixmap *pixmap);
|
||||||
|
|
||||||
WMPixmap* WMCreatePixmap(WMScreen *scrPtr, int width, int height, int depth,
|
WMPixmap* WMCreatePixmap(WMScreen *scrPtr, int width, int height, int depth,
|
||||||
Bool masked);
|
Bool masked);
|
||||||
|
|
||||||
WMPixmap* WMCreatePixmapFromXPixmaps(WMScreen *scrPtr, Pixmap pixmap,
|
WMPixmap* WMCreatePixmapFromXPixmaps(WMScreen *scrPtr, Pixmap pixmap,
|
||||||
Pixmap mask, int width, int height,
|
Pixmap mask, int width, int height,
|
||||||
int depth);
|
int depth);
|
||||||
|
|
||||||
WMPixmap* WMCreatePixmapFromRImage(WMScreen *scrPtr, RImage *image,
|
WMPixmap* WMCreatePixmapFromRImage(WMScreen *scrPtr, RImage *image,
|
||||||
int threshold);
|
int threshold);
|
||||||
|
|
||||||
WMPixmap* WMCreatePixmapFromXPMData(WMScreen *scrPtr, char **data);
|
WMPixmap* WMCreatePixmapFromXPMData(WMScreen *scrPtr, char **data);
|
||||||
|
|
||||||
@@ -785,7 +787,7 @@ WMPixmap* WMCreateBlendedPixmapFromRImage(WMScreen *scrPtr, RImage *image,
|
|||||||
RColor *color);
|
RColor *color);
|
||||||
|
|
||||||
WMPixmap* WMCreateBlendedPixmapFromFile(WMScreen *scrPtr, char *fileName,
|
WMPixmap* WMCreateBlendedPixmapFromFile(WMScreen *scrPtr, char *fileName,
|
||||||
RColor *color);
|
RColor *color);
|
||||||
|
|
||||||
void WMDrawPixmap(WMPixmap *pixmap, Drawable d, int x, int y);
|
void WMDrawPixmap(WMPixmap *pixmap, Drawable d, int x, int y);
|
||||||
|
|
||||||
@@ -813,15 +815,15 @@ GC WMColorGC(WMColor *color);
|
|||||||
WMPixel WMColorPixel(WMColor *color);
|
WMPixel WMColorPixel(WMColor *color);
|
||||||
|
|
||||||
void WMPaintColorSwatch(WMColor *color, Drawable d, int x, int y,
|
void WMPaintColorSwatch(WMColor *color, Drawable d, int x, int y,
|
||||||
unsigned int width, unsigned int height);
|
unsigned int width, unsigned int height);
|
||||||
|
|
||||||
void WMReleaseColor(WMColor *color);
|
void WMReleaseColor(WMColor *color);
|
||||||
|
|
||||||
WMColor* WMRetainColor(WMColor *color);
|
WMColor* WMRetainColor(WMColor *color);
|
||||||
|
|
||||||
WMColor* WMCreateRGBColor(WMScreen *scr, unsigned short red,
|
WMColor* WMCreateRGBColor(WMScreen *scr, unsigned short red,
|
||||||
unsigned short green, unsigned short blue,
|
unsigned short green, unsigned short blue,
|
||||||
Bool exact);
|
Bool exact);
|
||||||
|
|
||||||
WMColor* WMCreateRGBAColor(WMScreen *scr, unsigned short red,
|
WMColor* WMCreateRGBAColor(WMScreen *scr, unsigned short red,
|
||||||
unsigned short green, unsigned short blue,
|
unsigned short green, unsigned short blue,
|
||||||
@@ -908,7 +910,7 @@ void WMRedisplayWidget(WMWidget *w);
|
|||||||
void WMSetViewNotifySizeChanges(WMView *view, Bool flag);
|
void WMSetViewNotifySizeChanges(WMView *view, Bool flag);
|
||||||
|
|
||||||
void WMSetViewExpandsToParent(WMView *view, int topOffs, int leftOffs,
|
void WMSetViewExpandsToParent(WMView *view, int topOffs, int leftOffs,
|
||||||
int rightOffs, int bottomOffs);
|
int rightOffs, int bottomOffs);
|
||||||
|
|
||||||
WMSize WMGetViewSize(WMView *view);
|
WMSize WMGetViewSize(WMView *view);
|
||||||
|
|
||||||
@@ -952,7 +954,7 @@ WMWindow* WMCreateWindow(WMScreen *screen, char *name);
|
|||||||
WMWindow* WMCreateWindowWithStyle(WMScreen *screen, char *name, int style);
|
WMWindow* WMCreateWindowWithStyle(WMScreen *screen, char *name, int style);
|
||||||
|
|
||||||
WMWindow* WMCreatePanelWithStyleForWindow(WMWindow *owner, char *name,
|
WMWindow* WMCreatePanelWithStyleForWindow(WMWindow *owner, char *name,
|
||||||
int style);
|
int style);
|
||||||
|
|
||||||
WMWindow* WMCreatePanelForWindow(WMWindow *owner, char *name);
|
WMWindow* WMCreatePanelForWindow(WMWindow *owner, char *name);
|
||||||
|
|
||||||
@@ -971,7 +973,7 @@ void WMSetWindowInitialPosition(WMWindow *win, int x, int y);
|
|||||||
void WMSetWindowUserPosition(WMWindow *win, int x, int y);
|
void WMSetWindowUserPosition(WMWindow *win, int x, int y);
|
||||||
|
|
||||||
void WMSetWindowAspectRatio(WMWindow *win, int minX, int minY,
|
void WMSetWindowAspectRatio(WMWindow *win, int minX, int minY,
|
||||||
int maxX, int maxY);
|
int maxX, int maxY);
|
||||||
|
|
||||||
void WMSetWindowMaxSize(WMWindow *win, unsigned width, unsigned height);
|
void WMSetWindowMaxSize(WMWindow *win, unsigned width, unsigned height);
|
||||||
|
|
||||||
@@ -1137,7 +1139,7 @@ extern char *WMTextDidEndEditingNotification;
|
|||||||
WMScroller* WMCreateScroller(WMWidget *parent);
|
WMScroller* WMCreateScroller(WMWidget *parent);
|
||||||
|
|
||||||
void WMSetScrollerParameters(WMScroller *sPtr, float floatValue,
|
void WMSetScrollerParameters(WMScroller *sPtr, float floatValue,
|
||||||
float knobProportion);
|
float knobProportion);
|
||||||
|
|
||||||
float WMGetScrollerKnobProportion(WMScroller *sPtr);
|
float WMGetScrollerKnobProportion(WMScroller *sPtr);
|
||||||
|
|
||||||
@@ -1276,7 +1278,7 @@ WMArray* WMGetBrowserPaths(WMBrowser *bPtr);
|
|||||||
void WMSetBrowserAction(WMBrowser *bPtr, WMAction *action, void *clientData);
|
void WMSetBrowserAction(WMBrowser *bPtr, WMAction *action, void *clientData);
|
||||||
|
|
||||||
void WMSetBrowserDoubleAction(WMBrowser *bPtr, WMAction *action,
|
void WMSetBrowserDoubleAction(WMBrowser *bPtr, WMAction *action,
|
||||||
void *clientData);
|
void *clientData);
|
||||||
|
|
||||||
WMListItem* WMGetBrowserSelectedItemInColumn(WMBrowser *bPtr, int column);
|
WMListItem* WMGetBrowserSelectedItemInColumn(WMBrowser *bPtr, int column);
|
||||||
|
|
||||||
@@ -1368,14 +1370,14 @@ Bool WMGetMenuItemHasSubmenu(WMMenuItem *item);
|
|||||||
WMPopUpButton* WMCreatePopUpButton(WMWidget *parent);
|
WMPopUpButton* WMCreatePopUpButton(WMWidget *parent);
|
||||||
|
|
||||||
void WMSetPopUpButtonAction(WMPopUpButton *sPtr, WMAction *action,
|
void WMSetPopUpButtonAction(WMPopUpButton *sPtr, WMAction *action,
|
||||||
void *clientData);
|
void *clientData);
|
||||||
|
|
||||||
void WMSetPopUpButtonPullsDown(WMPopUpButton *bPtr, Bool flag);
|
void WMSetPopUpButtonPullsDown(WMPopUpButton *bPtr, Bool flag);
|
||||||
|
|
||||||
WMMenuItem* WMAddPopUpButtonItem(WMPopUpButton *bPtr, char *title);
|
WMMenuItem* WMAddPopUpButtonItem(WMPopUpButton *bPtr, char *title);
|
||||||
|
|
||||||
WMMenuItem* WMInsertPopUpButtonItem(WMPopUpButton *bPtr, int index,
|
WMMenuItem* WMInsertPopUpButtonItem(WMPopUpButton *bPtr, int index,
|
||||||
char *title);
|
char *title);
|
||||||
|
|
||||||
void WMRemovePopUpButtonItem(WMPopUpButton *bPtr, int index);
|
void WMRemovePopUpButtonItem(WMPopUpButton *bPtr, int index);
|
||||||
|
|
||||||
@@ -1394,7 +1396,6 @@ char* WMGetPopUpButtonItem(WMPopUpButton *bPtr, int index);
|
|||||||
|
|
||||||
WMMenuItem* WMGetPopUpButtonMenuItem(WMPopUpButton *bPtr, int index);
|
WMMenuItem* WMGetPopUpButtonMenuItem(WMPopUpButton *bPtr, int index);
|
||||||
|
|
||||||
|
|
||||||
int WMGetPopUpButtonNumberOfItems(WMPopUpButton *bPtr);
|
int WMGetPopUpButtonNumberOfItems(WMPopUpButton *bPtr);
|
||||||
|
|
||||||
void WMSetPopUpButtonEnabled(WMPopUpButton *bPtr, Bool flag);
|
void WMSetPopUpButtonEnabled(WMPopUpButton *bPtr, Bool flag);
|
||||||
@@ -1457,7 +1458,7 @@ extern char *WMColorWellDidChangeNotification;
|
|||||||
WMScrollView* WMCreateScrollView(WMWidget *parent);
|
WMScrollView* WMCreateScrollView(WMWidget *parent);
|
||||||
|
|
||||||
void WMResizeScrollViewContent(WMScrollView *sPtr, unsigned int width,
|
void WMResizeScrollViewContent(WMScrollView *sPtr, unsigned int width,
|
||||||
unsigned int height);
|
unsigned int height);
|
||||||
|
|
||||||
void WMSetScrollViewHasHorizontalScroller(WMScrollView *sPtr, Bool flag);
|
void WMSetScrollViewHasHorizontalScroller(WMScrollView *sPtr, Bool flag);
|
||||||
|
|
||||||
@@ -1524,8 +1525,8 @@ void WMAddSplitViewSubview(WMSplitView *sPtr, WMView *subview);
|
|||||||
|
|
||||||
void WMAdjustSplitViewSubviews(WMSplitView *sPtr);
|
void WMAdjustSplitViewSubviews(WMSplitView *sPtr);
|
||||||
|
|
||||||
void WMSetSplitViewConstrainProc(WMSplitView *sPtr,
|
void WMSetSplitViewConstrainProc(WMSplitView *sPtr,
|
||||||
WMSplitViewConstrainProc *proc);
|
WMSplitViewConstrainProc *proc);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
void WMSetSplitViewResizeSubviewsProc(WMSplitView *sPtr,
|
void WMSetSplitViewResizeSubviewsProc(WMSplitView *sPtr,
|
||||||
@@ -1713,7 +1714,7 @@ void WMInsertItemInTabView(WMTabView *tPtr, int index, WMTabViewItem *item);
|
|||||||
void WMRemoveTabViewItem(WMTabView *tPtr, WMTabViewItem *item);
|
void WMRemoveTabViewItem(WMTabView *tPtr, WMTabViewItem *item);
|
||||||
|
|
||||||
WMTabViewItem* WMAddTabViewItemWithView(WMTabView *tPtr, WMView *view,
|
WMTabViewItem* WMAddTabViewItemWithView(WMTabView *tPtr, WMView *view,
|
||||||
int identifier, char *label);
|
int identifier, char *label);
|
||||||
|
|
||||||
WMTabViewItem* WMTabViewItemAtPoint(WMTabView *tPtr, int x, int y);
|
WMTabViewItem* WMTabViewItemAtPoint(WMTabView *tPtr, int x, int y);
|
||||||
|
|
||||||
@@ -1758,10 +1759,10 @@ WMBox* WMCreateBox(WMWidget *parent);
|
|||||||
void WMSetBoxBorderWidth(WMBox *box, unsigned width);
|
void WMSetBoxBorderWidth(WMBox *box, unsigned width);
|
||||||
|
|
||||||
void WMAddBoxSubview(WMBox *bPtr, WMView *view, Bool expand, Bool fill,
|
void WMAddBoxSubview(WMBox *bPtr, WMView *view, Bool expand, Bool fill,
|
||||||
int minSize, int maxSize, int space);
|
int minSize, int maxSize, int space);
|
||||||
|
|
||||||
void WMAddBoxSubviewAtEnd(WMBox *bPtr, WMView *view, Bool expand, Bool fill,
|
void WMAddBoxSubviewAtEnd(WMBox *bPtr, WMView *view, Bool expand, Bool fill,
|
||||||
int minSize, int maxSize, int space);
|
int minSize, int maxSize, int space);
|
||||||
|
|
||||||
void WMRemoveBoxSubview(WMBox *bPtr, WMView *view);
|
void WMRemoveBoxSubview(WMBox *bPtr, WMView *view);
|
||||||
|
|
||||||
@@ -1775,20 +1776,20 @@ int WMRunAlertPanel(WMScreen *app, WMWindow *owner, char *title, char *msg,
|
|||||||
|
|
||||||
/* you can free the returned string */
|
/* you can free the returned string */
|
||||||
char* WMRunInputPanel(WMScreen *app, WMWindow *owner, char *title, char *msg,
|
char* WMRunInputPanel(WMScreen *app, WMWindow *owner, char *title, char *msg,
|
||||||
char *defaultText, char *okButton, char *cancelButton);
|
char *defaultText, char *okButton, char *cancelButton);
|
||||||
|
|
||||||
WMAlertPanel* WMCreateAlertPanel(WMScreen *app, WMWindow *owner, char *title,
|
WMAlertPanel* WMCreateAlertPanel(WMScreen *app, WMWindow *owner, char *title,
|
||||||
char *msg, char *defaultButton,
|
char *msg, char *defaultButton,
|
||||||
char *alternateButton, char *otherButton);
|
char *alternateButton, char *otherButton);
|
||||||
|
|
||||||
WMInputPanel* WMCreateInputPanel(WMScreen *app, WMWindow *owner, char *title,
|
WMInputPanel* WMCreateInputPanel(WMScreen *app, WMWindow *owner, char *title,
|
||||||
char *msg, char *defaultText, char *okButton,
|
char *msg, char *defaultText, char *okButton,
|
||||||
char *cancelButton);
|
char *cancelButton);
|
||||||
|
|
||||||
|
|
||||||
WMGenericPanel* WMCreateGenericPanel(WMScreen *scrPtr, WMWindow *owner,
|
WMGenericPanel* WMCreateGenericPanel(WMScreen *scrPtr, WMWindow *owner,
|
||||||
char *title, char *defaultButton,
|
char *title, char *defaultButton,
|
||||||
char *alternateButton);
|
char *alternateButton);
|
||||||
|
|
||||||
void WMDestroyAlertPanel(WMAlertPanel *panel);
|
void WMDestroyAlertPanel(WMAlertPanel *panel);
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#include <WINGs/WINGs.h>
|
#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.
|
#error There_is_an_old_WINGs.h_file_somewhere_in_your_system._Please_remove_it.
|
||||||
#endif
|
#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 {
|
struct W_DraggingInfo {
|
||||||
Window destinationWindow;
|
Window destinationWindow;
|
||||||
Window sourceWindow;
|
Window sourceWindow;
|
||||||
@@ -113,12 +160,13 @@ struct W_DraggingInfo {
|
|||||||
|
|
||||||
int protocolVersion;
|
int protocolVersion;
|
||||||
|
|
||||||
/* should be treated as internal data */
|
// should be treated as internal data
|
||||||
WMView *sourceView;
|
WMView *sourceView;
|
||||||
WMView *destView;
|
WMView *destView;
|
||||||
WMSize mouseOffset;
|
WMSize mouseOffset;
|
||||||
unsigned finished:1;
|
unsigned finished:1;
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
typedef struct W_Screen {
|
typedef struct W_Screen {
|
||||||
@@ -173,7 +221,7 @@ typedef struct W_Screen {
|
|||||||
|
|
||||||
struct W_View *dragSourceView;
|
struct W_View *dragSourceView;
|
||||||
struct W_DraggingInfo dragInfo;
|
struct W_DraggingInfo dragInfo;
|
||||||
|
|
||||||
/* colors */
|
/* colors */
|
||||||
W_Color *white;
|
W_Color *white;
|
||||||
W_Color *black;
|
W_Color *black;
|
||||||
@@ -181,12 +229,12 @@ typedef struct W_Screen {
|
|||||||
W_Color *darkGray;
|
W_Color *darkGray;
|
||||||
|
|
||||||
GC stippleGC;
|
GC stippleGC;
|
||||||
|
|
||||||
GC copyGC;
|
GC copyGC;
|
||||||
GC clipGC;
|
GC clipGC;
|
||||||
|
|
||||||
GC monoGC; /* GC for 1bpp visuals */
|
GC monoGC; /* GC for 1bpp visuals */
|
||||||
|
|
||||||
GC xorGC;
|
GC xorGC;
|
||||||
|
|
||||||
GC ixorGC; /* IncludeInferiors XOR */
|
GC ixorGC; /* IncludeInferiors XOR */
|
||||||
@@ -214,7 +262,7 @@ typedef struct W_Screen {
|
|||||||
|
|
||||||
struct W_Pixmap *checkButtonImageOn;
|
struct W_Pixmap *checkButtonImageOn;
|
||||||
struct W_Pixmap *checkButtonImageOff;
|
struct W_Pixmap *checkButtonImageOff;
|
||||||
|
|
||||||
struct W_Pixmap *radioButtonImageOn;
|
struct W_Pixmap *radioButtonImageOn;
|
||||||
struct W_Pixmap *radioButtonImageOff;
|
struct W_Pixmap *radioButtonImageOff;
|
||||||
|
|
||||||
@@ -222,12 +270,12 @@ typedef struct W_Screen {
|
|||||||
struct W_Pixmap *pushedButtonArrow;
|
struct W_Pixmap *pushedButtonArrow;
|
||||||
|
|
||||||
struct W_Pixmap *scrollerDimple;
|
struct W_Pixmap *scrollerDimple;
|
||||||
|
|
||||||
struct W_Pixmap *upArrow;
|
struct W_Pixmap *upArrow;
|
||||||
struct W_Pixmap *downArrow;
|
struct W_Pixmap *downArrow;
|
||||||
struct W_Pixmap *leftArrow;
|
struct W_Pixmap *leftArrow;
|
||||||
struct W_Pixmap *rightArrow;
|
struct W_Pixmap *rightArrow;
|
||||||
|
|
||||||
struct W_Pixmap *hiUpArrow;
|
struct W_Pixmap *hiUpArrow;
|
||||||
struct W_Pixmap *hiDownArrow;
|
struct W_Pixmap *hiDownArrow;
|
||||||
struct W_Pixmap *hiLeftArrow;
|
struct W_Pixmap *hiLeftArrow;
|
||||||
@@ -261,19 +309,19 @@ typedef struct W_Screen {
|
|||||||
struct W_Pixmap *hsbIcon;
|
struct W_Pixmap *hsbIcon;
|
||||||
struct W_Pixmap *customPaletteIcon;
|
struct W_Pixmap *customPaletteIcon;
|
||||||
struct W_Pixmap *colorListIcon;
|
struct W_Pixmap *colorListIcon;
|
||||||
|
|
||||||
struct W_Pixmap *defaultObjectIcon;
|
struct W_Pixmap *defaultObjectIcon;
|
||||||
|
|
||||||
Cursor defaultCursor;
|
Cursor defaultCursor;
|
||||||
|
|
||||||
Cursor textCursor;
|
Cursor textCursor;
|
||||||
|
|
||||||
Cursor invisibleCursor;
|
Cursor invisibleCursor;
|
||||||
|
|
||||||
Atom attribsAtom; /* GNUstepWindowAttributes */
|
Atom attribsAtom; /* GNUstepWindowAttributes */
|
||||||
|
|
||||||
Atom deleteWindowAtom; /* WM_DELETE_WINDOW */
|
Atom deleteWindowAtom; /* WM_DELETE_WINDOW */
|
||||||
|
|
||||||
Atom protocolsAtom; /* _XA_WM_PROTOCOLS */
|
Atom protocolsAtom; /* _XA_WM_PROTOCOLS */
|
||||||
|
|
||||||
Atom clipboardAtom; /* CLIPBOARD */
|
Atom clipboardAtom; /* CLIPBOARD */
|
||||||
@@ -286,6 +334,8 @@ typedef struct W_Screen {
|
|||||||
Atom xdndDropAtom;
|
Atom xdndDropAtom;
|
||||||
Atom xdndFinishedAtom;
|
Atom xdndFinishedAtom;
|
||||||
Atom xdndTypeListAtom;
|
Atom xdndTypeListAtom;
|
||||||
|
Atom xdndActionListAtom;
|
||||||
|
Atom xdndActionDescriptionAtom;
|
||||||
Atom xdndStatusAtom;
|
Atom xdndStatusAtom;
|
||||||
|
|
||||||
Atom xdndActionCopy;
|
Atom xdndActionCopy;
|
||||||
@@ -293,7 +343,7 @@ typedef struct W_Screen {
|
|||||||
Atom xdndActionLink;
|
Atom xdndActionLink;
|
||||||
Atom xdndActionAsk;
|
Atom xdndActionAsk;
|
||||||
Atom xdndActionPrivate;
|
Atom xdndActionPrivate;
|
||||||
|
|
||||||
Atom wmIconDragOffsetAtom;
|
Atom wmIconDragOffsetAtom;
|
||||||
|
|
||||||
Atom wmStateAtom; /* WM_STATE */
|
Atom wmStateAtom; /* WM_STATE */
|
||||||
@@ -335,30 +385,30 @@ typedef struct W_View {
|
|||||||
Window window;
|
Window window;
|
||||||
|
|
||||||
WMSize size;
|
WMSize size;
|
||||||
|
|
||||||
short topOffs;
|
short topOffs;
|
||||||
short leftOffs;
|
short leftOffs;
|
||||||
short bottomOffs;
|
short bottomOffs;
|
||||||
short rightOffs;
|
short rightOffs;
|
||||||
|
|
||||||
WMPoint pos;
|
WMPoint pos;
|
||||||
|
|
||||||
struct W_View *nextFocusChain; /* next/prev in focus chain */
|
struct W_View *nextFocusChain; /* next/prev in focus chain */
|
||||||
struct W_View *prevFocusChain;
|
struct W_View *prevFocusChain;
|
||||||
|
|
||||||
struct W_View *nextResponder; /* next to receive keyboard events */
|
struct W_View *nextResponder; /* next to receive keyboard events */
|
||||||
|
|
||||||
struct W_View *parent; /* parent WMView */
|
struct W_View *parent; /* parent WMView */
|
||||||
|
|
||||||
struct W_View *childrenList; /* first in list of child windows */
|
struct W_View *childrenList; /* first in list of child windows */
|
||||||
|
|
||||||
struct W_View *nextSister; /* next on parent's children list */
|
struct W_View *nextSister; /* next on parent's children list */
|
||||||
|
|
||||||
WMArray *eventHandlers; /* event handlers for this window */
|
WMArray *eventHandlers; /* event handlers for this window */
|
||||||
|
|
||||||
unsigned long attribFlags;
|
unsigned long attribFlags;
|
||||||
XSetWindowAttributes attribs;
|
XSetWindowAttributes attribs;
|
||||||
|
|
||||||
void *hangedData; /* data holder for user program */
|
void *hangedData; /* data holder for user program */
|
||||||
|
|
||||||
WMColor *backColor;
|
WMColor *backColor;
|
||||||
@@ -366,35 +416,36 @@ typedef struct W_View {
|
|||||||
Cursor cursor;
|
Cursor cursor;
|
||||||
|
|
||||||
Atom *droppableTypes;
|
Atom *droppableTypes;
|
||||||
struct W_DragSourceProcs *dragSourceProcs;
|
struct W_DragSourceProcs *dragSourceProcs;
|
||||||
struct W_DragDestinationProcs *dragDestinationProcs;
|
struct W_DragDestinationProcs *dragDestinationProcs;
|
||||||
|
WMPixmap *dragImage;
|
||||||
int helpContext;
|
int helpContext;
|
||||||
|
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
unsigned int realized:1;
|
unsigned int realized:1;
|
||||||
unsigned int mapped:1;
|
unsigned int mapped:1;
|
||||||
unsigned int parentDying:1;
|
unsigned int parentDying:1;
|
||||||
unsigned int dying:1; /* the view is being destroyed */
|
unsigned int dying:1; /* the view is being destroyed */
|
||||||
unsigned int topLevel:1; /* is a top level window */
|
unsigned int topLevel:1; /* is a top level window */
|
||||||
unsigned int root:1; /* is the root window */
|
unsigned int root:1; /* is the root window */
|
||||||
unsigned int mapWhenRealized:1;/* map the view when it's realized */
|
unsigned int mapWhenRealized:1; /* map the view when it's realized */
|
||||||
unsigned int alreadyDead:1; /* view was freed */
|
unsigned int alreadyDead:1; /* view was freed */
|
||||||
|
|
||||||
unsigned int dontCompressMotion:1; /* motion notify event compress */
|
unsigned int dontCompressMotion:1; /* motion notify event compress */
|
||||||
unsigned int notifySizeChanged:1;
|
unsigned int notifySizeChanged:1;
|
||||||
unsigned int dontCompressExpose:1; /* will compress all expose
|
unsigned int dontCompressExpose:1; /* expose event compress */
|
||||||
events into one */
|
|
||||||
/* toplevel only */
|
/* toplevel only */
|
||||||
unsigned int worksWhenModal:1;
|
unsigned int worksWhenModal:1;
|
||||||
unsigned int pendingRelease1:1;
|
unsigned int pendingRelease1:1;
|
||||||
unsigned int pendingRelease2:1;
|
unsigned int pendingRelease2:1;
|
||||||
unsigned int pendingRelease3:1;
|
unsigned int pendingRelease3:1;
|
||||||
unsigned int pendingRelease4:1;
|
unsigned int pendingRelease4:1;
|
||||||
unsigned int pendingRelease5:1;
|
unsigned int pendingRelease5:1;
|
||||||
unsigned int xdndHintSet:1;
|
unsigned int xdndHintSet:1;
|
||||||
} flags;
|
} flags;
|
||||||
|
|
||||||
int refCount;
|
int refCount;
|
||||||
} W_View;
|
} W_View;
|
||||||
|
|
||||||
@@ -434,7 +485,7 @@ extern _WINGsConfiguration WINGsConfiguration;
|
|||||||
|
|
||||||
#define W_VIEW_REALIZED(view) (view)->flags.realized
|
#define W_VIEW_REALIZED(view) (view)->flags.realized
|
||||||
#define W_VIEW_MAPPED(view) (view)->flags.mapped
|
#define W_VIEW_MAPPED(view) (view)->flags.mapped
|
||||||
|
|
||||||
#define W_VIEW_DISPLAY(view) (view)->screen->display
|
#define W_VIEW_DISPLAY(view) (view)->screen->display
|
||||||
#define W_VIEW_SCREEN(view) (view)->screen
|
#define W_VIEW_SCREEN(view) (view)->screen
|
||||||
#define W_VIEW_DRAWABLE(view) (view)->window
|
#define W_VIEW_DRAWABLE(view) (view)->window
|
||||||
@@ -492,19 +543,19 @@ void W_SetViewBackgroundColor(W_View *view, WMColor *color);
|
|||||||
void W_SetViewCursor(W_View *view, Cursor cursor);
|
void W_SetViewCursor(W_View *view, Cursor cursor);
|
||||||
|
|
||||||
void W_DrawRelief(W_Screen *scr, Drawable d, int x, int y, unsigned int width,
|
void W_DrawRelief(W_Screen *scr, Drawable d, int x, int y, unsigned int width,
|
||||||
unsigned int height, WMReliefType relief);
|
unsigned int height, WMReliefType relief);
|
||||||
|
|
||||||
void W_DrawReliefWithGC(W_Screen *scr, Drawable d, int x, int y,
|
void W_DrawReliefWithGC(W_Screen *scr, Drawable d, int x, int y,
|
||||||
unsigned int width, unsigned int height,
|
unsigned int width, unsigned int height,
|
||||||
WMReliefType relief,
|
WMReliefType relief,
|
||||||
GC black, GC dark, GC light, GC white);
|
GC black, GC dark, GC light, GC white);
|
||||||
|
|
||||||
void W_CallDestroyHandlers(W_View *view);
|
void W_CallDestroyHandlers(W_View *view);
|
||||||
|
|
||||||
void W_PaintTextAndImage(W_View *view, int wrap, WMColor *textColor,
|
void W_PaintTextAndImage(W_View *view, int wrap, WMColor *textColor,
|
||||||
W_Font *font, WMReliefType relief, char *text,
|
W_Font *font, WMReliefType relief, char *text,
|
||||||
WMAlignment alignment, W_Pixmap *image,
|
WMAlignment alignment, W_Pixmap *image,
|
||||||
WMImagePosition position, WMColor *backColor, int ofs);
|
WMImagePosition position, WMColor *backColor, int ofs);
|
||||||
|
|
||||||
void W_PaintText(W_View *view, Drawable d, WMFont *font, int x, int y,
|
void W_PaintText(W_View *view, Drawable d, WMFont *font, int x, int y,
|
||||||
int width, WMAlignment alignment, WMColor *color,
|
int width, WMAlignment alignment, WMColor *color,
|
||||||
@@ -525,7 +576,7 @@ void W_SetFocusOfToplevel(W_View *toplevel, W_View *view);
|
|||||||
W_View *W_FocusedViewOfToplevel(W_View *view);
|
W_View *W_FocusedViewOfToplevel(W_View *view);
|
||||||
|
|
||||||
void W_SetFocusOfTopLevel(W_View *toplevel, W_View *view);
|
void W_SetFocusOfTopLevel(W_View *toplevel, W_View *view);
|
||||||
|
|
||||||
void W_ReleaseView(WMView *view);
|
void W_ReleaseView(WMView *view);
|
||||||
|
|
||||||
WMView *W_RetainView(WMView *view);
|
WMView *W_RetainView(WMView *view);
|
||||||
@@ -560,6 +611,44 @@ void W_CheckTimerHandlers(void);
|
|||||||
|
|
||||||
Bool W_HandleInputEvents(Bool waitForInput, int inputfd);
|
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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|||||||
@@ -98,48 +98,48 @@ W_ReadConfigurations(void)
|
|||||||
if (defaults) {
|
if (defaults) {
|
||||||
char *buttonName;
|
char *buttonName;
|
||||||
unsigned button;
|
unsigned button;
|
||||||
char *str;
|
char *str;
|
||||||
|
|
||||||
WINGsConfiguration.systemFont =
|
WINGsConfiguration.systemFont =
|
||||||
WMGetUDStringForKey(defaults, "SystemFont");
|
WMGetUDStringForKey(defaults, "SystemFont");
|
||||||
|
|
||||||
WINGsConfiguration.boldSystemFont =
|
WINGsConfiguration.boldSystemFont =
|
||||||
WMGetUDStringForKey(defaults, "BoldSystemFont");
|
WMGetUDStringForKey(defaults, "BoldSystemFont");
|
||||||
|
|
||||||
#ifdef XFT
|
#ifdef XFT
|
||||||
WINGsConfiguration.antialiasedText =
|
WINGsConfiguration.antialiasedText =
|
||||||
WMGetUDBoolForKey(defaults, "AntialiasedText");
|
WMGetUDBoolForKey(defaults, "AntialiasedText");
|
||||||
#else
|
#else
|
||||||
WINGsConfiguration.antialiasedText = False;
|
WINGsConfiguration.antialiasedText = False;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
WINGsConfiguration.useMultiByte = False;
|
WINGsConfiguration.useMultiByte = False;
|
||||||
str = WMGetUDStringForKey(defaults, "MultiByteText");
|
str = WMGetUDStringForKey(defaults, "MultiByteText");
|
||||||
if (str) {
|
if (str) {
|
||||||
if (strcasecmp(str, "YES") == 0) {
|
if (strcasecmp(str, "YES") == 0) {
|
||||||
WINGsConfiguration.useMultiByte = True;
|
WINGsConfiguration.useMultiByte = True;
|
||||||
} else if (strcasecmp(str, "AUTO") == 0) {
|
} else if (strcasecmp(str, "AUTO") == 0) {
|
||||||
char *locale;
|
char *locale;
|
||||||
|
|
||||||
/* if it's a multibyte language (japanese, chinese or korean)
|
|
||||||
* then set it to True */
|
|
||||||
locale = setlocale(LC_CTYPE, NULL);
|
|
||||||
if (locale != NULL
|
|
||||||
&& (strncmp(locale, "ja", 2) == 0
|
|
||||||
|| strncmp(locale, "zh", 2) == 0
|
|
||||||
|| strncmp(locale, "ru", 2) == 0
|
|
||||||
|| strncmp(locale, "ko", 2) == 0)) {
|
|
||||||
|
|
||||||
WINGsConfiguration.useMultiByte = True;
|
/* if it's a multibyte language (japanese, chinese or korean)
|
||||||
}
|
* then set it to True */
|
||||||
}
|
locale = setlocale(LC_CTYPE, NULL);
|
||||||
}
|
if (locale != NULL
|
||||||
|
&& (strncmp(locale, "ja", 2) == 0
|
||||||
|
|| strncmp(locale, "zh", 2) == 0
|
||||||
|
|| strncmp(locale, "ru", 2) == 0
|
||||||
|
|| strncmp(locale, "ko", 2) == 0)) {
|
||||||
|
|
||||||
WINGsConfiguration.doubleClickDelay =
|
WINGsConfiguration.useMultiByte = True;
|
||||||
WMGetUDIntegerForKey(defaults, "DoubleClickTime");
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
WINGsConfiguration.floppyPath =
|
WINGsConfiguration.doubleClickDelay =
|
||||||
WMGetUDStringForKey(defaults, "FloppyPath");
|
WMGetUDIntegerForKey(defaults, "DoubleClickTime");
|
||||||
|
|
||||||
|
WINGsConfiguration.floppyPath =
|
||||||
|
WMGetUDStringForKey(defaults, "FloppyPath");
|
||||||
|
|
||||||
buttonName = WMGetUDStringForKey(defaults, "MouseWheelUp");
|
buttonName = WMGetUDStringForKey(defaults, "MouseWheelUp");
|
||||||
if (buttonName) {
|
if (buttonName) {
|
||||||
@@ -164,7 +164,7 @@ W_ReadConfigurations(void)
|
|||||||
WINGsConfiguration.mouseWheelDown = Button5;
|
WINGsConfiguration.mouseWheelDown = Button5;
|
||||||
}
|
}
|
||||||
|
|
||||||
WINGsConfiguration.defaultFontSize =
|
WINGsConfiguration.defaultFontSize =
|
||||||
WMGetUDIntegerForKey(defaults, "DefaultFontSize");
|
WMGetUDIntegerForKey(defaults, "DefaultFontSize");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,22 +172,22 @@ W_ReadConfigurations(void)
|
|||||||
WINGsConfiguration.systemFont = SYSTEM_FONT;
|
WINGsConfiguration.systemFont = SYSTEM_FONT;
|
||||||
}
|
}
|
||||||
if (missingOrInvalidXLFD(WINGsConfiguration.boldSystemFont)) {
|
if (missingOrInvalidXLFD(WINGsConfiguration.boldSystemFont)) {
|
||||||
WINGsConfiguration.boldSystemFont = BOLD_SYSTEM_FONT;
|
WINGsConfiguration.boldSystemFont = BOLD_SYSTEM_FONT;
|
||||||
}
|
}
|
||||||
if (!WINGsConfiguration.floppyPath) {
|
if (!WINGsConfiguration.floppyPath) {
|
||||||
WINGsConfiguration.floppyPath = FLOPPY_PATH;
|
WINGsConfiguration.floppyPath = FLOPPY_PATH;
|
||||||
}
|
}
|
||||||
if (WINGsConfiguration.doubleClickDelay == 0) {
|
if (WINGsConfiguration.doubleClickDelay == 0) {
|
||||||
WINGsConfiguration.doubleClickDelay = 250;
|
WINGsConfiguration.doubleClickDelay = 250;
|
||||||
}
|
}
|
||||||
if (WINGsConfiguration.mouseWheelUp == 0) {
|
if (WINGsConfiguration.mouseWheelUp == 0) {
|
||||||
WINGsConfiguration.mouseWheelUp = Button4;
|
WINGsConfiguration.mouseWheelUp = Button4;
|
||||||
}
|
}
|
||||||
if (WINGsConfiguration.mouseWheelDown == 0) {
|
if (WINGsConfiguration.mouseWheelDown == 0) {
|
||||||
WINGsConfiguration.mouseWheelDown = Button5;
|
WINGsConfiguration.mouseWheelDown = Button5;
|
||||||
}
|
}
|
||||||
if (WINGsConfiguration.defaultFontSize == 0) {
|
if (WINGsConfiguration.defaultFontSize == 0) {
|
||||||
WINGsConfiguration.defaultFontSize = 12;
|
WINGsConfiguration.defaultFontSize = 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
2317
WINGs/dragsource.c
2317
WINGs/dragsource.c
File diff suppressed because it is too large
Load Diff
@@ -865,7 +865,7 @@ getPropList(PLData *pldata)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case '(':
|
case '(':
|
||||||
DPUT("Getting PropList srrsy");
|
DPUT("Getting PropList array");
|
||||||
plist = getPLArray(pldata);
|
plist = getPLArray(pldata);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include "WINGsP.h"
|
#include "WINGsP.h"
|
||||||
|
|
||||||
|
#define XDND_COLOR_DATA_TYPE "application/X-color"
|
||||||
|
|
||||||
char *WMColorWellDidChangeNotification = "WMColorWellDidChangeNotification";
|
char *WMColorWellDidChangeNotification = "WMColorWellDidChangeNotification";
|
||||||
|
|
||||||
@@ -11,7 +12,7 @@ char *WMColorWellDidChangeNotification = "WMColorWellDidChangeNotification";
|
|||||||
typedef struct W_ColorWell {
|
typedef struct W_ColorWell {
|
||||||
W_Class widgetClass;
|
W_Class widgetClass;
|
||||||
WMView *view;
|
WMView *view;
|
||||||
|
|
||||||
WMView *colorView;
|
WMView *colorView;
|
||||||
|
|
||||||
WMColor *color;
|
WMColor *color;
|
||||||
@@ -22,9 +23,11 @@ typedef struct W_ColorWell {
|
|||||||
WMPoint ipoint;
|
WMPoint ipoint;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
unsigned int active:1;
|
unsigned int active:1;
|
||||||
unsigned int bordered:1;
|
unsigned int bordered:1;
|
||||||
} flags;
|
} flags;
|
||||||
|
|
||||||
|
WMArray *xdndTypes;
|
||||||
} ColorWell;
|
} ColorWell;
|
||||||
|
|
||||||
static char *_ColorWellActivatedNotification = "_ColorWellActivatedNotification";
|
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 WMData* fetchDragData(WMView *self, char *type);
|
||||||
|
|
||||||
static WMDragSourceProcs _DragSourceProcs = {
|
static WMDragSourceProcs _DragSourceProcs = {
|
||||||
draggingSourceOperation,
|
dropDataTypes,
|
||||||
|
wantedDropOperation,
|
||||||
|
NULL,
|
||||||
|
acceptDropOperation,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
fetchDragData
|
fetchDragData
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static unsigned draggingEntered(WMView *self, WMDraggingInfo *info);
|
static WMArray* requiredDataTypes(WMView *self,
|
||||||
static unsigned draggingUpdated(WMView *self, WMDraggingInfo *info);
|
WMDragOperationType requestedOperation, WMArray *sourceDataTypes);
|
||||||
static void draggingExited(WMView *self, WMDraggingInfo *info);
|
static WMDragOperationType allowedOperation(WMView *self,
|
||||||
static char *prepareForDragOperation(WMView *self, WMDraggingInfo *info);
|
WMDragOperationType requestedOperation, WMArray *sourceDataTypes);
|
||||||
static Bool performDragOperation(WMView *self, WMDraggingInfo *info,
|
static void performDragOperation(WMView *self, WMArray *dropDatas,
|
||||||
WMData *data);
|
WMArray *operationsList, WMPoint* dropLocation);
|
||||||
static void concludeDragOperation(WMView *self, WMDraggingInfo *info);
|
|
||||||
|
|
||||||
static WMDragDestinationProcs _DragDestinationProcs = {
|
static WMDragDestinationProcs _DragDestinationProcs = {
|
||||||
draggingEntered,
|
NULL,
|
||||||
draggingUpdated,
|
requiredDataTypes,
|
||||||
draggingExited,
|
allowedOperation,
|
||||||
prepareForDragOperation,
|
NULL,
|
||||||
performDragOperation,
|
performDragOperation ,
|
||||||
concludeDragOperation
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -100,10 +106,10 @@ colorChangedObserver(void *data, WMNotification *notification)
|
|||||||
WMColor *color;
|
WMColor *color;
|
||||||
|
|
||||||
if (!cPtr->flags.active)
|
if (!cPtr->flags.active)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
color = WMGetColorPanelColor(panel);
|
color = WMGetColorPanelColor(panel);
|
||||||
|
|
||||||
WMSetColorWellColor(cPtr, color);
|
WMSetColorWellColor(cPtr, color);
|
||||||
WMPostNotificationName(WMColorWellDidChangeNotification, cPtr, NULL);
|
WMPostNotificationName(WMColorWellDidChangeNotification, cPtr, NULL);
|
||||||
}
|
}
|
||||||
@@ -126,21 +132,30 @@ updateColorCallback(void *self, void *data)
|
|||||||
static void
|
static void
|
||||||
activatedObserver(void *data, WMNotification *notification)
|
activatedObserver(void *data, WMNotification *notification)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
WMColorWell *cPtr = (WMColorWell*)data;
|
WMColorWell *cPtr = (WMColorWell*)data;
|
||||||
|
|
||||||
if (!cPtr->flags.active || WMGetNotificationObject(notification) == cPtr)
|
if (!cPtr->flags.active || WMGetNotificationObject(notification) == cPtr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
W_SetViewBackgroundColor(cPtr->view, WMWidgetScreen(cPtr)->gray);
|
W_SetViewBackgroundColor(cPtr->view, WMWidgetScreen(cPtr)->gray);
|
||||||
paintColorWell(cPtr);
|
paintColorWell(cPtr);
|
||||||
|
|
||||||
cPtr->flags.active = 0;
|
cPtr->flags.active = 0;
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static WMArray*
|
||||||
|
getXdndTypeArray()
|
||||||
|
{
|
||||||
|
WMArray *types = WMCreateArray(1);
|
||||||
|
WMAddToArray(types, XDND_COLOR_DATA_TYPE);
|
||||||
|
return types;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
WMColorWell*
|
WMColorWell*
|
||||||
WMCreateColorWell(WMWidget *parent)
|
WMCreateColorWell(WMWidget *parent)
|
||||||
{
|
{
|
||||||
@@ -150,11 +165,11 @@ WMCreateColorWell(WMWidget *parent)
|
|||||||
memset(cPtr, 0, sizeof(ColorWell));
|
memset(cPtr, 0, sizeof(ColorWell));
|
||||||
|
|
||||||
cPtr->widgetClass = WC_ColorWell;
|
cPtr->widgetClass = WC_ColorWell;
|
||||||
|
|
||||||
cPtr->view = W_CreateView(W_VIEW(parent));
|
cPtr->view = W_CreateView(W_VIEW(parent));
|
||||||
if (!cPtr->view) {
|
if (!cPtr->view) {
|
||||||
wfree(cPtr);
|
wfree(cPtr);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
cPtr->view->self = cPtr;
|
cPtr->view->self = cPtr;
|
||||||
|
|
||||||
@@ -162,22 +177,21 @@ WMCreateColorWell(WMWidget *parent)
|
|||||||
|
|
||||||
cPtr->colorView = W_CreateView(cPtr->view);
|
cPtr->colorView = W_CreateView(cPtr->view);
|
||||||
if (!cPtr->colorView) {
|
if (!cPtr->colorView) {
|
||||||
W_DestroyView(cPtr->view);
|
W_DestroyView(cPtr->view);
|
||||||
wfree(cPtr);
|
wfree(cPtr);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
cPtr->colorView->self = cPtr;
|
cPtr->colorView->self = cPtr;
|
||||||
|
|
||||||
WMCreateEventHandler(cPtr->view, ExposureMask|StructureNotifyMask
|
WMCreateEventHandler(cPtr->view, ExposureMask|StructureNotifyMask
|
||||||
|ClientMessageMask, handleEvents, cPtr);
|
|ClientMessageMask, handleEvents, cPtr);
|
||||||
|
|
||||||
WMCreateEventHandler(cPtr->colorView, ExposureMask, handleEvents, cPtr);
|
WMCreateEventHandler(cPtr->colorView, ExposureMask, handleEvents, cPtr);
|
||||||
|
|
||||||
WMCreateEventHandler(cPtr->colorView, ButtonPressMask|ButtonMotionMask
|
WMCreateDragHandler(cPtr->colorView, handleDragEvents, cPtr);
|
||||||
|EnterWindowMask, handleDragEvents, cPtr);
|
|
||||||
|
|
||||||
WMCreateEventHandler(cPtr->view, ButtonPressMask, handleActionEvents,
|
WMCreateEventHandler(cPtr->view, ButtonPressMask, handleActionEvents,
|
||||||
cPtr);
|
cPtr);
|
||||||
|
|
||||||
cPtr->colorView->flags.mapWhenRealized = 1;
|
cPtr->colorView->flags.mapWhenRealized = 1;
|
||||||
|
|
||||||
@@ -185,22 +199,19 @@ WMCreateColorWell(WMWidget *parent)
|
|||||||
|
|
||||||
W_ResizeView(cPtr->view, DEFAULT_WIDTH, DEFAULT_HEIGHT);
|
W_ResizeView(cPtr->view, DEFAULT_WIDTH, DEFAULT_HEIGHT);
|
||||||
|
|
||||||
WMAddNotificationObserver(activatedObserver, cPtr,
|
WMAddNotificationObserver(activatedObserver, cPtr,
|
||||||
_ColorWellActivatedNotification, NULL);
|
_ColorWellActivatedNotification, NULL);
|
||||||
|
|
||||||
cPtr->color = WMBlackColor(WMWidgetScreen(cPtr));
|
cPtr->color = WMBlackColor(WMWidgetScreen(cPtr));
|
||||||
|
|
||||||
WMAddNotificationObserver(colorChangedObserver, cPtr,
|
WMAddNotificationObserver(colorChangedObserver, cPtr,
|
||||||
WMColorPanelColorChangedNotification, NULL);
|
WMColorPanelColorChangedNotification, NULL);
|
||||||
|
|
||||||
WMSetViewDragSourceProcs(cPtr->colorView, &_DragSourceProcs);
|
WMSetViewDragSourceProcs(cPtr->colorView, &_DragSourceProcs);
|
||||||
WMSetViewDragDestinationProcs(cPtr->colorView, &_DragDestinationProcs);
|
WMSetViewDragDestinationProcs(cPtr->colorView, &_DragDestinationProcs);
|
||||||
|
|
||||||
{
|
cPtr->xdndTypes = getXdndTypeArray();
|
||||||
char *types[2] = {"application/X-color", NULL};
|
WMRegisterViewForDraggedTypes(cPtr->colorView, cPtr->xdndTypes);
|
||||||
|
|
||||||
WMRegisterViewForDraggedTypes(cPtr->colorView, types);
|
|
||||||
}
|
|
||||||
|
|
||||||
return cPtr;
|
return cPtr;
|
||||||
}
|
}
|
||||||
@@ -210,12 +221,12 @@ void
|
|||||||
WMSetColorWellColor(WMColorWell *cPtr, WMColor *color)
|
WMSetColorWellColor(WMColorWell *cPtr, WMColor *color)
|
||||||
{
|
{
|
||||||
if (cPtr->color)
|
if (cPtr->color)
|
||||||
WMReleaseColor(cPtr->color);
|
WMReleaseColor(cPtr->color);
|
||||||
|
|
||||||
cPtr->color = WMRetainColor(color);
|
cPtr->color = WMRetainColor(color);
|
||||||
|
|
||||||
if (cPtr->colorView->flags.realized && cPtr->colorView->flags.mapped)
|
if (cPtr->colorView->flags.realized && cPtr->colorView->flags.mapped)
|
||||||
paintColorWell(cPtr);
|
paintColorWell(cPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -231,36 +242,36 @@ WSetColorWellBordered(WMColorWell *cPtr, Bool flag)
|
|||||||
{
|
{
|
||||||
flag = ((flag==0) ? 0 : 1);
|
flag = ((flag==0) ? 0 : 1);
|
||||||
if (cPtr->flags.bordered != flag) {
|
if (cPtr->flags.bordered != flag) {
|
||||||
cPtr->flags.bordered = flag;
|
cPtr->flags.bordered = flag;
|
||||||
W_ResizeView(cPtr->view, cPtr->view->size.width, cPtr->view->size.height);
|
W_ResizeView(cPtr->view, cPtr->view->size.width, cPtr->view->size.height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
willResizeColorWell(W_ViewDelegate *self, WMView *view,
|
willResizeColorWell(W_ViewDelegate *self, WMView *view,
|
||||||
unsigned int *width, unsigned int *height)
|
unsigned int *width, unsigned int *height)
|
||||||
{
|
{
|
||||||
WMColorWell *cPtr = (WMColorWell*)view->self;
|
WMColorWell *cPtr = (WMColorWell*)view->self;
|
||||||
int bw;
|
int bw;
|
||||||
|
|
||||||
if (cPtr->flags.bordered) {
|
if (cPtr->flags.bordered) {
|
||||||
|
|
||||||
if (*width < MIN_WIDTH)
|
if (*width < MIN_WIDTH)
|
||||||
*width = MIN_WIDTH;
|
*width = MIN_WIDTH;
|
||||||
if (*height < MIN_HEIGHT)
|
if (*height < MIN_HEIGHT)
|
||||||
*height = MIN_HEIGHT;
|
*height = MIN_HEIGHT;
|
||||||
|
|
||||||
bw = (int)((float)WMIN(*width, *height)*0.24);
|
bw = (int)((float)WMIN(*width, *height)*0.24);
|
||||||
|
|
||||||
W_ResizeView(cPtr->colorView, *width-2*bw, *height-2*bw);
|
W_ResizeView(cPtr->colorView, *width-2*bw, *height-2*bw);
|
||||||
|
|
||||||
if (cPtr->colorView->pos.x!=bw || cPtr->colorView->pos.y!=bw)
|
if (cPtr->colorView->pos.x!=bw || cPtr->colorView->pos.y!=bw)
|
||||||
W_MoveView(cPtr->colorView, bw, bw);
|
W_MoveView(cPtr->colorView, bw, bw);
|
||||||
} else {
|
} else {
|
||||||
W_ResizeView(cPtr->colorView, *width, *height);
|
W_ResizeView(cPtr->colorView, *width, *height);
|
||||||
|
|
||||||
W_MoveView(cPtr->colorView, 0, 0);
|
W_MoveView(cPtr->colorView, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -271,16 +282,16 @@ paintColorWell(ColorWell *cPtr)
|
|||||||
W_Screen *scr = cPtr->view->screen;
|
W_Screen *scr = cPtr->view->screen;
|
||||||
|
|
||||||
W_DrawRelief(scr, cPtr->view->window, 0, 0, cPtr->view->size.width,
|
W_DrawRelief(scr, cPtr->view->window, 0, 0, cPtr->view->size.width,
|
||||||
cPtr->view->size.height, WRRaised);
|
cPtr->view->size.height, WRRaised);
|
||||||
|
|
||||||
W_DrawRelief(scr, cPtr->colorView->window, 0, 0,
|
W_DrawRelief(scr, cPtr->colorView->window, 0, 0,
|
||||||
cPtr->colorView->size.width, cPtr->colorView->size.height,
|
cPtr->colorView->size.width, cPtr->colorView->size.height,
|
||||||
WRSunken);
|
WRSunken);
|
||||||
|
|
||||||
if (cPtr->color)
|
if (cPtr->color)
|
||||||
WMPaintColorSwatch(cPtr->color, cPtr->colorView->window,
|
WMPaintColorSwatch(cPtr->color, cPtr->colorView->window,
|
||||||
2, 2, cPtr->colorView->size.width-4,
|
2, 2, cPtr->colorView->size.width-4,
|
||||||
cPtr->colorView->size.height-4);
|
cPtr->colorView->size.height-4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -293,38 +304,51 @@ handleEvents(XEvent *event, void *data)
|
|||||||
CHECK_CLASS(data, WC_ColorWell);
|
CHECK_CLASS(data, WC_ColorWell);
|
||||||
|
|
||||||
|
|
||||||
switch (event->type) {
|
switch (event->type) {
|
||||||
case Expose:
|
case Expose:
|
||||||
if (event->xexpose.count!=0)
|
if (event->xexpose.count!=0)
|
||||||
break;
|
break;
|
||||||
paintColorWell(cPtr);
|
paintColorWell(cPtr);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DestroyNotify:
|
case DestroyNotify:
|
||||||
destroyColorWell(cPtr);
|
destroyColorWell(cPtr);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static unsigned
|
static WMArray*
|
||||||
draggingSourceOperation(WMView *self, Bool local)
|
dropDataTypes(WMView *self)
|
||||||
|
{
|
||||||
|
return ((ColorWell*)self->self)->xdndTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static WMDragOperationType
|
||||||
|
wantedDropOperation(WMView *self)
|
||||||
{
|
{
|
||||||
return WDOperationCopy;
|
return WDOperationCopy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static WMData*
|
static Bool
|
||||||
|
acceptDropOperation(WMView *self, WMDragOperationType operation)
|
||||||
|
{
|
||||||
|
return (operation == WDOperationCopy);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static WMData*
|
||||||
fetchDragData(WMView *self, char *type)
|
fetchDragData(WMView *self, char *type)
|
||||||
{
|
{
|
||||||
char *color = WMGetColorRGBDescription(((WMColorWell*)self->self)->color);
|
char *color = WMGetColorRGBDescription(((WMColorWell*)self->self)->color);
|
||||||
WMData *data;
|
WMData *data;
|
||||||
|
|
||||||
data = WMCreateDataWithBytes(color, strlen(color)+1);
|
data = WMCreateDataWithBytes(color, strlen(color)+1);
|
||||||
|
|
||||||
wfree(color);
|
wfree(color);
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -334,13 +358,13 @@ makeDragPixmap(WMColorWell *cPtr)
|
|||||||
{
|
{
|
||||||
WMScreen *scr = cPtr->view->screen;
|
WMScreen *scr = cPtr->view->screen;
|
||||||
Pixmap pix;
|
Pixmap pix;
|
||||||
|
|
||||||
pix = XCreatePixmap(scr->display, W_DRAWABLE(scr), 16, 16, scr->depth);
|
pix = XCreatePixmap(scr->display, W_DRAWABLE(scr), 16, 16, scr->depth);
|
||||||
|
|
||||||
XFillRectangle(scr->display, pix, WMColorGC(cPtr->color), 0, 0, 15, 15);
|
XFillRectangle(scr->display, pix, WMColorGC(cPtr->color), 0, 0, 15, 15);
|
||||||
|
|
||||||
XDrawRectangle(scr->display, pix, WMColorGC(scr->black), 0, 0, 15, 15);
|
XDrawRectangle(scr->display, pix, WMColorGC(scr->black), 0, 0, 15, 15);
|
||||||
|
|
||||||
return WMCreatePixmapFromXPixmaps(scr, pix, None, 16, 16, scr->depth);
|
return WMCreatePixmapFromXPixmaps(scr, pix, None, 16, 16, scr->depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -350,36 +374,12 @@ handleDragEvents(XEvent *event, void *data)
|
|||||||
{
|
{
|
||||||
WMColorWell *cPtr = (ColorWell*)data;
|
WMColorWell *cPtr = (ColorWell*)data;
|
||||||
|
|
||||||
switch (event->type) {
|
if (event->type == ButtonPress && event->xbutton.button == Button1) {
|
||||||
case ButtonPress:
|
/* initialise drag icon */
|
||||||
if (event->xbutton.button == Button1) {
|
WMSetViewDragImage(cPtr->colorView, makeDragPixmap(cPtr));
|
||||||
cPtr->ipoint.x = event->xbutton.x;
|
|
||||||
cPtr->ipoint.y = event->xbutton.y;
|
|
||||||
}
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -389,24 +389,24 @@ handleActionEvents(XEvent *event, void *data)
|
|||||||
WMColorWell *cPtr = (ColorWell*)data;
|
WMColorWell *cPtr = (ColorWell*)data;
|
||||||
WMScreen *scr = WMWidgetScreen(cPtr);
|
WMScreen *scr = WMWidgetScreen(cPtr);
|
||||||
WMColorPanel *cpanel;
|
WMColorPanel *cpanel;
|
||||||
|
|
||||||
if (cPtr->flags.active)
|
if (cPtr->flags.active)
|
||||||
W_SetViewBackgroundColor(cPtr->view, scr->gray);
|
W_SetViewBackgroundColor(cPtr->view, scr->gray);
|
||||||
else
|
else
|
||||||
W_SetViewBackgroundColor(cPtr->view, scr->white);
|
W_SetViewBackgroundColor(cPtr->view, scr->white);
|
||||||
paintColorWell(cPtr);
|
paintColorWell(cPtr);
|
||||||
|
|
||||||
cPtr->flags.active ^= 1;
|
cPtr->flags.active ^= 1;
|
||||||
|
|
||||||
if (cPtr->flags.active) {
|
if (cPtr->flags.active) {
|
||||||
WMPostNotificationName(_ColorWellActivatedNotification, cPtr, NULL);
|
WMPostNotificationName(_ColorWellActivatedNotification, cPtr, NULL);
|
||||||
}
|
}
|
||||||
cpanel = WMGetColorPanel(scr);
|
cpanel = WMGetColorPanel(scr);
|
||||||
|
|
||||||
WMSetColorPanelAction(cpanel, updateColorCallback, cPtr);
|
WMSetColorPanelAction(cpanel, updateColorCallback, cPtr);
|
||||||
|
|
||||||
if (cPtr->color)
|
if (cPtr->color)
|
||||||
WMSetColorPanelColor(cpanel, cPtr->color);
|
WMSetColorPanelColor(cpanel, cPtr->color);
|
||||||
WMShowColorPanel(cpanel);
|
WMShowColorPanel(cpanel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -417,58 +417,69 @@ destroyColorWell(ColorWell *cPtr)
|
|||||||
WMRemoveNotificationObserver(cPtr);
|
WMRemoveNotificationObserver(cPtr);
|
||||||
|
|
||||||
if (cPtr->color)
|
if (cPtr->color)
|
||||||
WMReleaseColor(cPtr->color);
|
WMReleaseColor(cPtr->color);
|
||||||
|
|
||||||
|
WMFreeArray(cPtr->xdndTypes);
|
||||||
|
|
||||||
wfree(cPtr);
|
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
|
static Bool
|
||||||
performDragOperation(WMView *self, WMDraggingInfo *info, WMData *data)
|
dropIsOk(WMDragOperationType request, WMArray *sourceDataTypes)
|
||||||
{
|
{
|
||||||
char *colorName = (char*)WMDataBytes(data);
|
WMArrayIterator iter;
|
||||||
WMColor *color;
|
char *type;
|
||||||
|
|
||||||
color = WMCreateNamedColor(W_VIEW_SCREEN(self), colorName, True);
|
if (request == WDOperationCopy) {
|
||||||
|
WM_ITERATE_ARRAY(sourceDataTypes, type, iter) {
|
||||||
WMSetColorWellColor(self->self, color);
|
if (type != NULL && strcmp(type, XDND_COLOR_DATA_TYPE)==0) {
|
||||||
|
return True;
|
||||||
WMReleaseColor(color);
|
}
|
||||||
|
}
|
||||||
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
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
266
WINGs/wevent.c
266
WINGs/wevent.c
@@ -63,20 +63,20 @@ static WMEventHook *extraEventHandler=NULL;
|
|||||||
* Create an event handler and put it in the event handler list for the
|
* Create an event handler and put it in the event handler list for the
|
||||||
* view. If the same callback and clientdata are already used in another
|
* view. If the same callback and clientdata are already used in another
|
||||||
* handler, the masks are OR'ed.
|
* handler, the masks are OR'ed.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
WMCreateEventHandler(WMView *view, unsigned long mask, WMEventProc *eventProc,
|
WMCreateEventHandler(WMView *view, unsigned long mask, WMEventProc *eventProc,
|
||||||
void *clientData)
|
void *clientData)
|
||||||
{
|
{
|
||||||
W_EventHandler *hPtr;
|
W_EventHandler *hPtr;
|
||||||
WMArrayIterator iter;
|
WMArrayIterator iter;
|
||||||
|
|
||||||
WM_ITERATE_ARRAY(view->eventHandlers, hPtr, iter) {
|
WM_ITERATE_ARRAY(view->eventHandlers, hPtr, iter) {
|
||||||
if (hPtr->clientData==clientData && hPtr->proc==eventProc) {
|
if (hPtr->clientData==clientData && hPtr->proc==eventProc) {
|
||||||
hPtr->eventMask |= mask;
|
hPtr->eventMask |= mask;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
hPtr = wmalloc(sizeof(W_EventHandler));
|
hPtr = wmalloc(sizeof(W_EventHandler));
|
||||||
@@ -105,11 +105,11 @@ matchHandler(void *item, void *cdata)
|
|||||||
* WMDeleteEventHandler--
|
* WMDeleteEventHandler--
|
||||||
* Delete event handler matching arguments from windows
|
* Delete event handler matching arguments from windows
|
||||||
* event handler list.
|
* event handler list.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
WMDeleteEventHandler(WMView *view, unsigned long mask, WMEventProc *eventProc,
|
WMDeleteEventHandler(WMView *view, unsigned long mask, WMEventProc *eventProc,
|
||||||
void *clientData)
|
void *clientData)
|
||||||
{
|
{
|
||||||
W_EventHandler tmp;
|
W_EventHandler tmp;
|
||||||
|
|
||||||
@@ -124,27 +124,27 @@ static Time
|
|||||||
getEventTime(WMScreen *screen, XEvent *event)
|
getEventTime(WMScreen *screen, XEvent *event)
|
||||||
{
|
{
|
||||||
switch (event->type) {
|
switch (event->type) {
|
||||||
case ButtonPress:
|
case ButtonPress:
|
||||||
case ButtonRelease:
|
case ButtonRelease:
|
||||||
return event->xbutton.time;
|
return event->xbutton.time;
|
||||||
case KeyPress:
|
case KeyPress:
|
||||||
case KeyRelease:
|
case KeyRelease:
|
||||||
return event->xkey.time;
|
return event->xkey.time;
|
||||||
case MotionNotify:
|
case MotionNotify:
|
||||||
return event->xmotion.time;
|
return event->xmotion.time;
|
||||||
case EnterNotify:
|
case EnterNotify:
|
||||||
case LeaveNotify:
|
case LeaveNotify:
|
||||||
return event->xcrossing.time;
|
return event->xcrossing.time;
|
||||||
case PropertyNotify:
|
case PropertyNotify:
|
||||||
return event->xproperty.time;
|
return event->xproperty.time;
|
||||||
case SelectionClear:
|
case SelectionClear:
|
||||||
return event->xselectionclear.time;
|
return event->xselectionclear.time;
|
||||||
case SelectionRequest:
|
case SelectionRequest:
|
||||||
return event->xselectionrequest.time;
|
return event->xselectionrequest.time;
|
||||||
case SelectionNotify:
|
case SelectionNotify:
|
||||||
return event->xselection.time;
|
return event->xselection.time;
|
||||||
default:
|
default:
|
||||||
return screen->lastEventTime;
|
return screen->lastEventTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,9 +162,9 @@ W_CallDestroyHandlers(W_View *view)
|
|||||||
event.xdestroywindow.event = view->window;
|
event.xdestroywindow.event = view->window;
|
||||||
|
|
||||||
WM_ITERATE_ARRAY(view->eventHandlers, hPtr, iter) {
|
WM_ITERATE_ARRAY(view->eventHandlers, hPtr, iter) {
|
||||||
if (hPtr->eventMask & StructureNotifyMask) {
|
if (hPtr->eventMask & StructureNotifyMask) {
|
||||||
(*hPtr->proc)(&event, hPtr->clientData);
|
(*hPtr->proc)(&event, hPtr->clientData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,7 +175,7 @@ WMSetViewNextResponder(WMView *view, WMView *responder)
|
|||||||
{
|
{
|
||||||
/* set the widget to receive keyboard events that aren't handled
|
/* set the widget to receive keyboard events that aren't handled
|
||||||
* by this widget */
|
* by this widget */
|
||||||
|
|
||||||
view->nextResponder = responder;
|
view->nextResponder = responder;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,15 +186,15 @@ WMRelayToNextResponder(WMView *view, XEvent *event)
|
|||||||
unsigned long mask = eventMasks[event->xany.type];
|
unsigned long mask = eventMasks[event->xany.type];
|
||||||
|
|
||||||
if (view->nextResponder) {
|
if (view->nextResponder) {
|
||||||
WMView *next = view->nextResponder;
|
WMView *next = view->nextResponder;
|
||||||
W_EventHandler *hPtr;
|
W_EventHandler *hPtr;
|
||||||
WMArrayIterator iter;
|
WMArrayIterator iter;
|
||||||
|
|
||||||
WM_ITERATE_ARRAY(next->eventHandlers, hPtr, iter) {
|
WM_ITERATE_ARRAY(next->eventHandlers, hPtr, iter) {
|
||||||
if ((hPtr->eventMask & mask)) {
|
if ((hPtr->eventMask & mask)) {
|
||||||
(*hPtr->proc)(event, hPtr->clientData);
|
(*hPtr->proc)(event, hPtr->clientData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,28 +209,28 @@ WMHandleEvent(XEvent *event)
|
|||||||
WMArrayIterator iter;
|
WMArrayIterator iter;
|
||||||
|
|
||||||
if (event->type == MappingNotify) {
|
if (event->type == MappingNotify) {
|
||||||
XRefreshKeyboardMapping(&event->xmapping);
|
XRefreshKeyboardMapping(&event->xmapping);
|
||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
|
|
||||||
mask = eventMasks[event->xany.type];
|
mask = eventMasks[event->xany.type];
|
||||||
|
|
||||||
window = event->xany.window;
|
window = event->xany.window;
|
||||||
|
|
||||||
/* diferentiate SubstructureNotify with StructureNotify */
|
/* diferentiate SubstructureNotify with StructureNotify */
|
||||||
if (mask == StructureNotifyMask) {
|
if (mask == StructureNotifyMask) {
|
||||||
if (event->xmap.event != event->xmap.window) {
|
if (event->xmap.event != event->xmap.window) {
|
||||||
mask = SubstructureNotifyMask;
|
mask = SubstructureNotifyMask;
|
||||||
window = event->xmap.event;
|
window = event->xmap.event;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
view = W_GetViewForXWindow(event->xany.display, window);
|
view = W_GetViewForXWindow(event->xany.display, window);
|
||||||
|
|
||||||
if (!view) {
|
if (!view) {
|
||||||
if (extraEventHandler)
|
if (extraEventHandler)
|
||||||
(extraEventHandler)(event);
|
(extraEventHandler)(event);
|
||||||
|
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
view->screen->lastEventTime = getEventTime(view->screen, event);
|
view->screen->lastEventTime = getEventTime(view->screen, event);
|
||||||
@@ -238,22 +238,19 @@ WMHandleEvent(XEvent *event)
|
|||||||
toplevel = W_TopLevelOfView(view);
|
toplevel = W_TopLevelOfView(view);
|
||||||
|
|
||||||
if (event->type == SelectionNotify || event->type == SelectionClear
|
if (event->type == SelectionNotify || event->type == SelectionClear
|
||||||
|| event->type == SelectionRequest) {
|
|| event->type == SelectionRequest) {
|
||||||
/* handle selection related events */
|
/* handle selection related events */
|
||||||
W_HandleSelectionEvent(event);
|
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 */
|
/* if it's a key event, redispatch it to the focused control */
|
||||||
if (mask & (KeyPressMask|KeyReleaseMask)) {
|
if (mask & (KeyPressMask|KeyReleaseMask)) {
|
||||||
W_View *focused = W_FocusedViewOfToplevel(toplevel);
|
W_View *focused = W_FocusedViewOfToplevel(toplevel);
|
||||||
|
|
||||||
if (focused) {
|
if (focused) {
|
||||||
view = focused;
|
view = focused;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* compress Motion events */
|
/* compress Motion events */
|
||||||
@@ -261,37 +258,37 @@ WMHandleEvent(XEvent *event)
|
|||||||
while (XPending(event->xmotion.display)) {
|
while (XPending(event->xmotion.display)) {
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
XPeekEvent(event->xmotion.display, &ev);
|
XPeekEvent(event->xmotion.display, &ev);
|
||||||
if (ev.type == MotionNotify
|
if (ev.type == MotionNotify
|
||||||
&& event->xmotion.window == ev.xmotion.window
|
&& event->xmotion.window == ev.xmotion.window
|
||||||
&& event->xmotion.subwindow == ev.xmotion.subwindow) {
|
&& event->xmotion.subwindow == ev.xmotion.subwindow) {
|
||||||
/* replace events */
|
/* replace events */
|
||||||
XNextEvent(event->xmotion.display, event);
|
XNextEvent(event->xmotion.display, event);
|
||||||
} else break;
|
} else break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* compress expose events */
|
/* compress expose events */
|
||||||
if (event->type == Expose && !view->flags.dontCompressExpose) {
|
if (event->type == Expose && !view->flags.dontCompressExpose) {
|
||||||
while (XCheckTypedWindowEvent(event->xexpose.display, view->window,
|
while (XCheckTypedWindowEvent(event->xexpose.display, view->window,
|
||||||
Expose, event));
|
Expose, event));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (view->screen->modalLoop && toplevel!=view->screen->modalView
|
if (view->screen->modalLoop && toplevel!=view->screen->modalView
|
||||||
&& !toplevel->flags.worksWhenModal) {
|
&& !toplevel->flags.worksWhenModal) {
|
||||||
if (event->type == KeyPress || event->type == KeyRelease
|
if (event->type == KeyPress || event->type == KeyRelease
|
||||||
|| event->type == MotionNotify || event->type == ButtonPress
|
|| event->type == MotionNotify || event->type == ButtonPress
|
||||||
|| event->type == ButtonRelease
|
|| event->type == ButtonRelease
|
||||||
|| event->type == FocusIn || event->type == FocusOut) {
|
|| event->type == FocusIn || event->type == FocusOut) {
|
||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* do balloon stuffs */
|
/* do balloon stuffs */
|
||||||
if (event->type == EnterNotify)
|
if (event->type == EnterNotify)
|
||||||
W_BalloonHandleEnterView(view);
|
W_BalloonHandleEnterView(view);
|
||||||
else if (event->type == LeaveNotify)
|
else if (event->type == LeaveNotify)
|
||||||
W_BalloonHandleLeaveView(view);
|
W_BalloonHandleLeaveView(view);
|
||||||
|
|
||||||
/* This is a hack. It will make the panel be secure while
|
/* This is a hack. It will make the panel be secure while
|
||||||
* the event handlers are handled, as some event handler
|
* the event handlers are handled, as some event handler
|
||||||
@@ -299,33 +296,38 @@ WMHandleEvent(XEvent *event)
|
|||||||
W_RetainView(toplevel);
|
W_RetainView(toplevel);
|
||||||
|
|
||||||
WM_ITERATE_ARRAY(view->eventHandlers, hPtr, iter) {
|
WM_ITERATE_ARRAY(view->eventHandlers, hPtr, iter) {
|
||||||
if ((hPtr->eventMask & mask)) {
|
if ((hPtr->eventMask & mask)) {
|
||||||
(*hPtr->proc)(event, hPtr->clientData);
|
(*hPtr->proc)(event, hPtr->clientData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if 0
|
#if 0
|
||||||
/* pass the event to the top level window of the widget */
|
/* pass the event to the top level window of the widget */
|
||||||
/* TODO: change this to a responder chain */
|
/* TODO: change this to a responder chain */
|
||||||
if (view->parent != NULL) {
|
if (view->parent != NULL) {
|
||||||
vPtr = view;
|
vPtr = view;
|
||||||
while (vPtr->parent != NULL)
|
while (vPtr->parent != NULL)
|
||||||
vPtr = vPtr->parent;
|
vPtr = vPtr->parent;
|
||||||
|
|
||||||
WM_ITERATE_ARRAY(vPtr->eventHandlers, hPtr, iter) {
|
WM_ITERATE_ARRAY(vPtr->eventHandlers, hPtr, iter) {
|
||||||
if (hPtr->eventMask & mask) {
|
if (hPtr->eventMask & mask) {
|
||||||
(*hPtr->proc)(event, hPtr->clientData);
|
(*hPtr->proc)(event, hPtr->clientData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* save button click info to track double-clicks */
|
/* save button click info to track double-clicks */
|
||||||
if (view->screen->ignoreNextDoubleClick) {
|
if (view->screen->ignoreNextDoubleClick) {
|
||||||
view->screen->ignoreNextDoubleClick = 0;
|
view->screen->ignoreNextDoubleClick = 0;
|
||||||
} else {
|
} else {
|
||||||
if (event->type == ButtonPress) {
|
if (event->type == ButtonPress) {
|
||||||
view->screen->lastClickWindow = event->xbutton.window;
|
view->screen->lastClickWindow = event->xbutton.window;
|
||||||
view->screen->lastClickTime = event->xbutton.time;
|
view->screen->lastClickTime = event->xbutton.time;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
W_ReleaseView(toplevel);
|
||||||
@@ -338,26 +340,26 @@ int
|
|||||||
WMIsDoubleClick(XEvent *event)
|
WMIsDoubleClick(XEvent *event)
|
||||||
{
|
{
|
||||||
W_View *view;
|
W_View *view;
|
||||||
|
|
||||||
if (event->type != ButtonPress)
|
if (event->type != ButtonPress)
|
||||||
return False;
|
return False;
|
||||||
|
|
||||||
view = W_GetViewForXWindow(event->xany.display, event->xbutton.window);
|
view = W_GetViewForXWindow(event->xany.display, event->xbutton.window);
|
||||||
|
|
||||||
if (!view)
|
if (!view)
|
||||||
return False;
|
return False;
|
||||||
|
|
||||||
if (view->screen->lastClickWindow != event->xbutton.window)
|
if (view->screen->lastClickWindow != event->xbutton.window)
|
||||||
return False;
|
return False;
|
||||||
|
|
||||||
if (event->xbutton.time - view->screen->lastClickTime
|
if (event->xbutton.time - view->screen->lastClickTime
|
||||||
< WINGsConfiguration.doubleClickDelay) {
|
< WINGsConfiguration.doubleClickDelay) {
|
||||||
view->screen->lastClickTime = 0;
|
view->screen->lastClickTime = 0;
|
||||||
view->screen->lastClickWindow = None;
|
view->screen->lastClickWindow = None;
|
||||||
view->screen->ignoreNextDoubleClick = 1;
|
view->screen->ignoreNextDoubleClick = 1;
|
||||||
return True;
|
return True;
|
||||||
} else
|
} else
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -381,14 +383,14 @@ waitForEvent(Display *dpy, unsigned long xeventmask, Bool waitForInput)
|
|||||||
{
|
{
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
if (xeventmask==0) {
|
if (xeventmask==0) {
|
||||||
if (XPending(dpy))
|
if (XPending(dpy))
|
||||||
return True;
|
return True;
|
||||||
} else {
|
} else {
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
if (XCheckMaskEvent(dpy, xeventmask, &ev)) {
|
if (XCheckMaskEvent(dpy, xeventmask, &ev)) {
|
||||||
XPutBackEvent(dpy, &ev);
|
XPutBackEvent(dpy, &ev);
|
||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return W_HandleInputEvents(waitForInput, ConnectionNumber(dpy));
|
return W_HandleInputEvents(waitForInput, ConnectionNumber(dpy));
|
||||||
@@ -402,19 +404,19 @@ WMNextEvent(Display *dpy, XEvent *event)
|
|||||||
W_CheckTimerHandlers();
|
W_CheckTimerHandlers();
|
||||||
|
|
||||||
while (XPending(dpy) == 0) {
|
while (XPending(dpy) == 0) {
|
||||||
/* Do idle and timer stuff while there are no input or X events */
|
/* Do idle and timer stuff while there are no input or X events */
|
||||||
while (!waitForEvent(dpy, 0, False) && W_CheckIdleHandlers()) {
|
while (!waitForEvent(dpy, 0, False) && W_CheckIdleHandlers()) {
|
||||||
/* dispatch timer events */
|
/* dispatch timer events */
|
||||||
W_CheckTimerHandlers();
|
W_CheckTimerHandlers();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make sure that new events did not arrive while we were doing
|
* Make sure that new events did not arrive while we were doing
|
||||||
* timer/idle stuff. Or we might block forever waiting for
|
* timer/idle stuff. Or we might block forever waiting for
|
||||||
* an event that already arrived.
|
* an event that already arrived.
|
||||||
*/
|
*/
|
||||||
/* wait for something to happen or a timer to expire */
|
/* wait for something to happen or a timer to expire */
|
||||||
waitForEvent(dpy, 0, True);
|
waitForEvent(dpy, 0, True);
|
||||||
|
|
||||||
/* Check any expired timers */
|
/* Check any expired timers */
|
||||||
W_CheckTimerHandlers();
|
W_CheckTimerHandlers();
|
||||||
@@ -431,16 +433,16 @@ WMMaskEvent(Display *dpy, long mask, XEvent *event)
|
|||||||
W_CheckTimerHandlers();
|
W_CheckTimerHandlers();
|
||||||
|
|
||||||
while (!XCheckMaskEvent(dpy, mask, event)) {
|
while (!XCheckMaskEvent(dpy, mask, event)) {
|
||||||
/* Do idle and timer stuff while there are no input or X events */
|
/* Do idle and timer stuff while there are no input or X events */
|
||||||
while (!waitForEvent(dpy, mask, False) && W_CheckIdleHandlers()) {
|
while (!waitForEvent(dpy, mask, False) && W_CheckIdleHandlers()) {
|
||||||
W_CheckTimerHandlers();
|
W_CheckTimerHandlers();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (XCheckMaskEvent(dpy, mask, event))
|
if (XCheckMaskEvent(dpy, mask, event))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Wait for input on the X connection socket or another input handler */
|
/* Wait for input on the X connection socket or another input handler */
|
||||||
waitForEvent(dpy, mask, True);
|
waitForEvent(dpy, mask, True);
|
||||||
|
|
||||||
/* Check any expired timers */
|
/* Check any expired timers */
|
||||||
W_CheckTimerHandlers();
|
W_CheckTimerHandlers();
|
||||||
@@ -452,9 +454,9 @@ Bool
|
|||||||
WMScreenPending(WMScreen *scr)
|
WMScreenPending(WMScreen *scr)
|
||||||
{
|
{
|
||||||
if (XPending(scr->display))
|
if (XPending(scr->display))
|
||||||
return True;
|
return True;
|
||||||
else
|
else
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -462,9 +464,9 @@ WMEventHook*
|
|||||||
WMHookEventHandler(WMEventHook *handler)
|
WMHookEventHandler(WMEventHook *handler)
|
||||||
{
|
{
|
||||||
WMEventHook *oldHandler = extraEventHandler;
|
WMEventHook *oldHandler = extraEventHandler;
|
||||||
|
|
||||||
extraEventHandler = handler;
|
extraEventHandler = handler;
|
||||||
|
|
||||||
return oldHandler;
|
return oldHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
427
WINGs/wfont.c
427
WINGs/wfont.c
@@ -149,8 +149,8 @@ alreadyHasStringValue(XftPattern *pattern, const char *object, char *value)
|
|||||||
return True;
|
return True;
|
||||||
|
|
||||||
id = 0;
|
id = 0;
|
||||||
while ((r=XftPatternGetString(pattern, object, id, &s))!=XftResultNoId) {
|
while ((r=XftPatternGetString(pattern, object, id, &s))==XftResultMatch) {
|
||||||
if (r == XftResultMatch && strcasecmp(value, s) == 0) {
|
if (strcasecmp(value, s) == 0) {
|
||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
id++;
|
id++;
|
||||||
@@ -165,23 +165,21 @@ alreadyHasStringValue(XftPattern *pattern, const char *object, char *value)
|
|||||||
static char*
|
static char*
|
||||||
makeFontOfSize(char *font, int size, char *fallback)
|
makeFontOfSize(char *font, int size, char *fallback)
|
||||||
{
|
{
|
||||||
XftPattern *pattern;
|
FcPattern *pattern;
|
||||||
char *result;
|
char *result;
|
||||||
int len;
|
|
||||||
|
|
||||||
len = strlen(font) + 64;
|
|
||||||
pattern = XftNameParse(font);
|
pattern = XftNameParse(font);
|
||||||
XftPatternDel(pattern, "pixelsize");
|
XftPatternDel(pattern, "pixelsize");
|
||||||
XftPatternAddDouble(pattern, "pixelsize", (double)size);
|
XftPatternAddDouble(pattern, "pixelsize", (double)size);
|
||||||
|
|
||||||
if (fallback) {
|
if (fallback) {
|
||||||
if (!alreadyHasStringValue(pattern, "family", fallback)) {
|
if (!alreadyHasStringValue(pattern, "family", fallback)) {
|
||||||
len += strlen(fallback);
|
|
||||||
XftPatternAddString(pattern, "family", fallback);
|
XftPatternAddString(pattern, "family", fallback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result = wmalloc(len);
|
|
||||||
XftNameUnparse(pattern, result, len);
|
result = FcNameUnparse(pattern);
|
||||||
XftPatternDestroy(pattern);
|
FcPatternDestroy(pattern);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -198,17 +196,17 @@ WMCreateFont(WMScreen *scrPtr, char *fontName)
|
|||||||
if (fontName[0]=='-' && (ptr = strchr(fontName, ','))) {
|
if (fontName[0]=='-' && (ptr = strchr(fontName, ','))) {
|
||||||
// warn for deprecation
|
// warn for deprecation
|
||||||
fname = wmalloc(ptr - fontName + 1);
|
fname = wmalloc(ptr - fontName + 1);
|
||||||
strncpy(fname, fontName, ptr - fontName);
|
strncpy(fname, fontName, ptr - fontName);
|
||||||
fname[ptr - fontName] = 0;
|
fname[ptr - fontName] = 0;
|
||||||
} else {
|
} else {
|
||||||
fname = wstrdup(fontName);
|
fname = wstrdup(fontName);
|
||||||
}
|
}
|
||||||
|
|
||||||
font = WMHashGet(scrPtr->fontCache, fname);
|
font = WMHashGet(scrPtr->fontCache, fname);
|
||||||
if (font) {
|
if (font) {
|
||||||
WMRetainFont(font);
|
WMRetainFont(font);
|
||||||
wfree(fname);
|
wfree(fname);
|
||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
|
|
||||||
font = wmalloc(sizeof(WMFont));
|
font = wmalloc(sizeof(WMFont));
|
||||||
@@ -217,7 +215,7 @@ WMCreateFont(WMScreen *scrPtr, char *fontName)
|
|||||||
font->screen = scrPtr;
|
font->screen = scrPtr;
|
||||||
|
|
||||||
// remove
|
// remove
|
||||||
printf("%s\n", fname);
|
printf("WMCreateFont: %s\n", fname);
|
||||||
|
|
||||||
if (fname[0] == '-') {
|
if (fname[0] == '-') {
|
||||||
// Backward compat thing. Remove in a later version
|
// Backward compat thing. Remove in a later version
|
||||||
@@ -264,9 +262,9 @@ WMReleaseFont(WMFont *font)
|
|||||||
XftFontClose(font->screen->display, font->font);
|
XftFontClose(font->screen->display, font->font);
|
||||||
if (font->name) {
|
if (font->name) {
|
||||||
WMHashRemove(font->screen->fontCache, font->name);
|
WMHashRemove(font->screen->fontCache, font->name);
|
||||||
wfree(font->name);
|
wfree(font->name);
|
||||||
}
|
}
|
||||||
wfree(font);
|
wfree(font);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -489,166 +487,50 @@ WMDrawImageString(WMScreen *scr, Drawable d, WMColor *color, WMColor *background
|
|||||||
|
|
||||||
|
|
||||||
WMFont*
|
WMFont*
|
||||||
WMCopyFontWithChanges(WMScreen *scrPtr, WMFont *font,
|
WMCopyFontWithStyle(WMScreen *scrPtr, WMFont *font, WMFontStyle style)
|
||||||
const WMFontAttributes *changes)
|
|
||||||
{
|
{
|
||||||
int index[FONT_PROPS], count[FONT_PROPS];
|
FcPattern *pattern;
|
||||||
int totalProps, i, j, carry;
|
WMFont *copy;
|
||||||
char fname[512];
|
char *name;
|
||||||
WMFontFlags fFlags;
|
|
||||||
WMBag *props;
|
|
||||||
WMArray *options;
|
|
||||||
WMFont *result;
|
|
||||||
char *prop;
|
|
||||||
|
|
||||||
snprintf(fname, 512, "%s", font->name);
|
if (!font)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
fFlags = (font->antialiased ? WFAntialiased : WFNotAntialiased);
|
pattern = XftNameParse(WMGetFontName(font));
|
||||||
fFlags |= (font->notFontSet ? WFNormalFont : WFFontSet);
|
switch (style) {
|
||||||
|
case WFSNormal:
|
||||||
props = WMCreateBagWithDestructor(1, (WMFreeDataProc*)WMFreeArray);
|
XftPatternDel(pattern, "weight");
|
||||||
|
XftPatternDel(pattern, "slant");
|
||||||
totalProps = 0;
|
XftPatternAddString(pattern, "weight", "medium");
|
||||||
for (i=0; i<FONT_PROPS; i++) {
|
XftPatternAddString(pattern, "slant", "roman");
|
||||||
prop = ((W_FontAttributes*)changes)->props[i];
|
break;
|
||||||
count[i] = index[i] = 0;
|
case WFSBold:
|
||||||
if (!prop) {
|
XftPatternDel(pattern, "weight");
|
||||||
/* No change for this property */
|
XftPatternAddString(pattern, "weight", "bold");
|
||||||
continue;
|
break;
|
||||||
} else if (strchr(prop, ',')==NULL) {
|
case WFSEmphasized:
|
||||||
/* Simple option */
|
XftPatternDel(pattern, "slant");
|
||||||
changeFontProp(fname, prop, i);
|
XftPatternAddString(pattern, "slant", "italic");
|
||||||
} else {
|
XftPatternAddString(pattern, "slant", "oblique");
|
||||||
/* Option with fallback alternatives */
|
break;
|
||||||
if ((changes==WFAEmphasized || changes==WFABoldEmphasized) &&
|
case WFSBoldEmphasized:
|
||||||
font->antialiased && strcmp(prop, "o,i")==0) {
|
XftPatternDel(pattern, "weight");
|
||||||
options = getOptions("i,o");
|
XftPatternDel(pattern, "slant");
|
||||||
} else {
|
XftPatternAddString(pattern, "weight", "bold");
|
||||||
options = getOptions(prop);
|
XftPatternAddString(pattern, "slant", "italic");
|
||||||
}
|
XftPatternAddString(pattern, "slant", "oblique");
|
||||||
WMInsertInBag(props, i, options);
|
break;
|
||||||
count[i] = WMGetArrayItemCount(options);
|
|
||||||
if (totalProps==0)
|
|
||||||
totalProps = 1;
|
|
||||||
totalProps = totalProps * count[i];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (totalProps == 0) {
|
name = FcNameUnparse(pattern);
|
||||||
/* No options with fallback alternatives at all */
|
copy = WMCreateFont(scrPtr, name);
|
||||||
WMFreeBag(props);
|
FcPatternDestroy(pattern);
|
||||||
return WMCreateFontWithFlags(scrPtr, fname, fFlags);
|
wfree(name);
|
||||||
}
|
|
||||||
|
|
||||||
for (i=0; i<totalProps; i++) {
|
return copy;
|
||||||
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);
|
|
||||||
|
|
||||||
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;
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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 */
|
#else /* No XFT support */
|
||||||
|
|
||||||
|
|
||||||
@@ -662,18 +544,18 @@ getElementFromXLFD(const char *xlfd, int index)
|
|||||||
{
|
{
|
||||||
const char *p = xlfd;
|
const char *p = xlfd;
|
||||||
while (*p != 0) {
|
while (*p != 0) {
|
||||||
if (*p == '-' && --index == 0) {
|
if (*p == '-' && --index == 0) {
|
||||||
const char *end = strchr(p + 1, '-');
|
const char *end = strchr(p + 1, '-');
|
||||||
char *buf;
|
char *buf;
|
||||||
size_t len;
|
size_t len;
|
||||||
if (end == 0) end = p + strlen(p);
|
if (end == 0) end = p + strlen(p);
|
||||||
len = end - (p + 1);
|
len = end - (p + 1);
|
||||||
buf = wmalloc(len);
|
buf = wmalloc(len);
|
||||||
memcpy(buf, p + 1, len);
|
memcpy(buf, p + 1, len);
|
||||||
buf[len] = 0;
|
buf[len] = 0;
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
return strdup("*");
|
return strdup("*");
|
||||||
}
|
}
|
||||||
@@ -695,8 +577,8 @@ generalizeXLFD(const char *xlfd)
|
|||||||
|
|
||||||
buf = wmalloc(len + 1);
|
buf = wmalloc(len + 1);
|
||||||
snprintf(buf, len + 1, "%s,-*-*-%s-%s-*-*-%s-*-*-*-*-*-*-*,"
|
snprintf(buf, len + 1, "%s,-*-*-%s-%s-*-*-%s-*-*-*-*-*-*-*,"
|
||||||
"-*-*-*-*-*-*-%s-*-*-*-*-*-*-*,*",
|
"-*-*-*-*-*-*-%s-*-*-*-*-*-*-*,*",
|
||||||
xlfd, weight, slant, pxlsz, pxlsz);
|
xlfd, weight, slant, pxlsz, pxlsz);
|
||||||
|
|
||||||
wfree(pxlsz);
|
wfree(pxlsz);
|
||||||
wfree(slant);
|
wfree(slant);
|
||||||
@@ -708,27 +590,27 @@ generalizeXLFD(const char *xlfd)
|
|||||||
/* XLFD pattern matching */
|
/* XLFD pattern matching */
|
||||||
static XFontSet
|
static XFontSet
|
||||||
W_CreateFontSetWithGuess(Display *dpy, char *xlfd, char ***missing,
|
W_CreateFontSetWithGuess(Display *dpy, char *xlfd, char ***missing,
|
||||||
int *nmissing, char **def_string)
|
int *nmissing, char **def_string)
|
||||||
{
|
{
|
||||||
XFontSet fs = XCreateFontSet(dpy, xlfd, missing, nmissing, def_string);
|
XFontSet fs = XCreateFontSet(dpy, xlfd, missing, nmissing, def_string);
|
||||||
|
|
||||||
if (fs != NULL && *nmissing == 0) return fs;
|
if (fs != NULL && *nmissing == 0) return fs;
|
||||||
|
|
||||||
/* for non-iso8859-1 language and iso8859-1 specification
|
/* for non-iso8859-1 language and iso8859-1 specification
|
||||||
(this fontset is only for pattern analysis) */
|
(this fontset is only for pattern analysis) */
|
||||||
if (fs == NULL) {
|
if (fs == NULL) {
|
||||||
if (*nmissing != 0) XFreeStringList(*missing);
|
if (*nmissing != 0) XFreeStringList(*missing);
|
||||||
setlocale(LC_CTYPE, "C");
|
setlocale(LC_CTYPE, "C");
|
||||||
fs = XCreateFontSet(dpy, xlfd, missing, nmissing, def_string);
|
fs = XCreateFontSet(dpy, xlfd, missing, nmissing, def_string);
|
||||||
setlocale(LC_CTYPE, "");
|
setlocale(LC_CTYPE, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* make XLFD font name for pattern analysis */
|
/* make XLFD font name for pattern analysis */
|
||||||
if (fs != NULL) {
|
if (fs != NULL) {
|
||||||
XFontStruct **fontstructs;
|
XFontStruct **fontstructs;
|
||||||
char **fontnames;
|
char **fontnames;
|
||||||
if (XFontsOfFontSet(fs, &fontstructs, &fontnames) > 0)
|
if (XFontsOfFontSet(fs, &fontstructs, &fontnames) > 0)
|
||||||
xlfd = fontnames[0];
|
xlfd = fontnames[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
xlfd = generalizeXLFD(xlfd);
|
xlfd = generalizeXLFD(xlfd);
|
||||||
@@ -805,7 +687,7 @@ WMCreateFontSet(WMScreen *scrPtr, char *fontName)
|
|||||||
if (font) {
|
if (font) {
|
||||||
WMRetainFont(font);
|
WMRetainFont(font);
|
||||||
wfree(fname);
|
wfree(fname);
|
||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
|
|
||||||
font = wmalloc(sizeof(WMFont));
|
font = wmalloc(sizeof(WMFont));
|
||||||
@@ -819,21 +701,21 @@ WMCreateFontSet(WMScreen *scrPtr, char *fontName)
|
|||||||
font->font.set = W_CreateFontSetWithGuess(display, fname, &missing,
|
font->font.set = W_CreateFontSetWithGuess(display, fname, &missing,
|
||||||
&nmissing, &defaultString);
|
&nmissing, &defaultString);
|
||||||
if (nmissing > 0 && font->font.set) {
|
if (nmissing > 0 && font->font.set) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
wwarning(_("the following character sets are missing in %s:"), fname);
|
wwarning(_("the following character sets are missing in %s:"), fname);
|
||||||
for (i = 0; i < nmissing; i++) {
|
for (i = 0; i < nmissing; i++) {
|
||||||
wwarning(missing[i]);
|
wwarning(missing[i]);
|
||||||
}
|
}
|
||||||
XFreeStringList(missing);
|
XFreeStringList(missing);
|
||||||
if (defaultString)
|
if (defaultString)
|
||||||
wwarning(_("the string \"%s\" will be used in place of any characters from those sets."),
|
wwarning(_("the string \"%s\" will be used in place of any characters from those sets."),
|
||||||
defaultString);
|
defaultString);
|
||||||
}
|
}
|
||||||
if (!font->font.set) {
|
if (!font->font.set) {
|
||||||
wfree(font);
|
wfree(font);
|
||||||
wfree(fname);
|
wfree(fname);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
extents = XExtentsOfFontSet(font->font.set);
|
extents = XExtentsOfFontSet(font->font.set);
|
||||||
@@ -862,20 +744,20 @@ WMCreateNormalFont(WMScreen *scrPtr, char *fontName)
|
|||||||
fontName = xlfdFromFontName(fontName, False);
|
fontName = xlfdFromFontName(fontName, False);
|
||||||
|
|
||||||
if ((ptr = strchr(fontName, ','))) {
|
if ((ptr = strchr(fontName, ','))) {
|
||||||
fname = wmalloc(ptr - fontName + 1);
|
fname = wmalloc(ptr - fontName + 1);
|
||||||
strncpy(fname, fontName, ptr - fontName);
|
strncpy(fname, fontName, ptr - fontName);
|
||||||
fname[ptr - fontName] = 0;
|
fname[ptr - fontName] = 0;
|
||||||
} else {
|
} else {
|
||||||
fname = wstrdup(fontName);
|
fname = wstrdup(fontName);
|
||||||
}
|
}
|
||||||
|
|
||||||
wfree(fontName);
|
wfree(fontName);
|
||||||
|
|
||||||
font = WMHashGet(scrPtr->fontCache, fname);
|
font = WMHashGet(scrPtr->fontCache, fname);
|
||||||
if (font) {
|
if (font) {
|
||||||
WMRetainFont(font);
|
WMRetainFont(font);
|
||||||
wfree(fname);
|
wfree(fname);
|
||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
|
|
||||||
font = wmalloc(sizeof(WMFont));
|
font = wmalloc(sizeof(WMFont));
|
||||||
@@ -916,20 +798,20 @@ WMCreateAntialiasedFont(WMScreen *scrPtr, char *fontName)
|
|||||||
fontName = xlfdFromFontName(fontName, True);
|
fontName = xlfdFromFontName(fontName, True);
|
||||||
|
|
||||||
if ((ptr = strchr(fontName, ','))) {
|
if ((ptr = strchr(fontName, ','))) {
|
||||||
fname = wmalloc(ptr - fontName + 1);
|
fname = wmalloc(ptr - fontName + 1);
|
||||||
strncpy(fname, fontName, ptr - fontName);
|
strncpy(fname, fontName, ptr - fontName);
|
||||||
fname[ptr - fontName] = 0;
|
fname[ptr - fontName] = 0;
|
||||||
} else {
|
} else {
|
||||||
fname = wstrdup(fontName);
|
fname = wstrdup(fontName);
|
||||||
}
|
}
|
||||||
|
|
||||||
wfree(fontName);
|
wfree(fontName);
|
||||||
|
|
||||||
font = WMHashGet(scrPtr->xftFontCache, fname);
|
font = WMHashGet(scrPtr->xftFontCache, fname);
|
||||||
if (font) {
|
if (font) {
|
||||||
WMRetainFont(font);
|
WMRetainFont(font);
|
||||||
wfree(fname);
|
wfree(fname);
|
||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
|
|
||||||
font = wmalloc(sizeof(WMFont));
|
font = wmalloc(sizeof(WMFont));
|
||||||
@@ -993,19 +875,19 @@ WMCreateAntialiasedFontSet(WMScreen *scrPtr, char *fontName)
|
|||||||
|
|
||||||
if ((ptr = strchr(fontName, ','))) {
|
if ((ptr = strchr(fontName, ','))) {
|
||||||
fname = wmalloc(ptr - fontName + 1);
|
fname = wmalloc(ptr - fontName + 1);
|
||||||
strncpy(fname, fontName, ptr - fontName);
|
strncpy(fname, fontName, ptr - fontName);
|
||||||
fname[ptr - fontName] = 0;
|
fname[ptr - fontName] = 0;
|
||||||
} else {
|
} else {
|
||||||
fname = wstrdup(fontName);
|
fname = wstrdup(fontName);
|
||||||
}
|
}
|
||||||
|
|
||||||
wfree(fontName);
|
wfree(fontName);
|
||||||
|
|
||||||
font = WMHashGet(scrPtr->xftFontSetCache, fname);
|
font = WMHashGet(scrPtr->xftFontSetCache, fname);
|
||||||
if (font) {
|
if (font) {
|
||||||
WMRetainFont(font);
|
WMRetainFont(font);
|
||||||
wfree(fname);
|
wfree(fname);
|
||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
|
|
||||||
font = wmalloc(sizeof(WMFont));
|
font = wmalloc(sizeof(WMFont));
|
||||||
@@ -1096,7 +978,7 @@ WMCreateFontWithFlags(WMScreen *scrPtr, char *fontName, WMFontFlags flags)
|
|||||||
font = WMCreateNormalFont(scrPtr, fontName);
|
font = WMCreateNormalFont(scrPtr, fontName);
|
||||||
}
|
}
|
||||||
} else if (multiByte) {
|
} else if (multiByte) {
|
||||||
font = WMCreateFontSet(scrPtr, fontName);
|
font = WMCreateFontSet(scrPtr, fontName);
|
||||||
} else {
|
} else {
|
||||||
font = WMCreateNormalFont(scrPtr, fontName);
|
font = WMCreateNormalFont(scrPtr, fontName);
|
||||||
}
|
}
|
||||||
@@ -1145,9 +1027,9 @@ WMReleaseFont(WMFont *font)
|
|||||||
} else {
|
} else {
|
||||||
WMHashRemove(font->screen->fontSetCache, font->name);
|
WMHashRemove(font->screen->fontSetCache, font->name);
|
||||||
}
|
}
|
||||||
wfree(font->name);
|
wfree(font->name);
|
||||||
}
|
}
|
||||||
wfree(font);
|
wfree(font);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1401,7 +1283,7 @@ WMDrawString(WMScreen *scr, Drawable d, WMColor *color, WMFont *font,
|
|||||||
/* we can draw normal text, or we can draw as much widechar
|
/* we can draw normal text, or we can draw as much widechar
|
||||||
* text as was already converted until the error. go figure */
|
* text as was already converted until the error. go figure */
|
||||||
/*XftDrawString8(scr->xftdraw, &xftcolor, font->font.xft,
|
/*XftDrawString8(scr->xftdraw, &xftcolor, font->font.xft,
|
||||||
x, y + font->y, (XftChar8*)text, length);*/
|
x, y + font->y, (XftChar8*)text, length);*/
|
||||||
}
|
}
|
||||||
wfree(wtext);
|
wfree(wtext);
|
||||||
} else {
|
} else {
|
||||||
@@ -1472,7 +1354,7 @@ WMDrawImageString(WMScreen *scr, Drawable d, WMColor *color, WMColor *background
|
|||||||
/* we can draw normal text, or we can draw as much widechar
|
/* we can draw normal text, or we can draw as much widechar
|
||||||
* text as was already converted until the error. go figure */
|
* text as was already converted until the error. go figure */
|
||||||
/*XftDrawString8(scr->xftdraw, &textColor, font->font.xft,
|
/*XftDrawString8(scr->xftdraw, &textColor, font->font.xft,
|
||||||
x, y + font->y, (XftChar8*)text, length);*/
|
x, y + font->y, (XftChar8*)text, length);*/
|
||||||
}
|
}
|
||||||
wfree(wtext);
|
wfree(wtext);
|
||||||
} else {
|
} else {
|
||||||
@@ -1507,42 +1389,42 @@ makeFontSetOfSize(char *fontset, int size)
|
|||||||
char *ptr;
|
char *ptr;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
char *tmp;
|
char *tmp;
|
||||||
int end;
|
int end;
|
||||||
|
|
||||||
|
|
||||||
f = fontset;
|
f = fontset;
|
||||||
ptr = strchr(fontset, ',');
|
ptr = strchr(fontset, ',');
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
int count = ptr-fontset;
|
int count = ptr-fontset;
|
||||||
|
|
||||||
if (count > 255) {
|
if (count > 255) {
|
||||||
wwarning(_("font description %s is too large."), fontset);
|
wwarning(_("font description %s is too large."), fontset);
|
||||||
} else {
|
} else {
|
||||||
memcpy(font, fontset, count);
|
memcpy(font, fontset, count);
|
||||||
font[count] = 0;
|
font[count] = 0;
|
||||||
f = (char*)font;
|
f = (char*)font;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newfs)
|
if (newfs)
|
||||||
end = strlen(newfs);
|
end = strlen(newfs);
|
||||||
else
|
else
|
||||||
end = 0;
|
end = 0;
|
||||||
|
|
||||||
tmp = wmalloc(end + strlen(f) + 8);
|
tmp = wmalloc(end + strlen(f) + 8);
|
||||||
if (end != 0) {
|
if (end != 0) {
|
||||||
sprintf(tmp, "%s,", newfs);
|
sprintf(tmp, "%s,", newfs);
|
||||||
sprintf(tmp + end + 1, f, size);
|
sprintf(tmp + end + 1, f, size);
|
||||||
} else {
|
} else {
|
||||||
sprintf(tmp + end, f, size);
|
sprintf(tmp + end, f, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newfs)
|
if (newfs)
|
||||||
wfree(newfs);
|
wfree(newfs);
|
||||||
newfs = tmp;
|
newfs = tmp;
|
||||||
|
|
||||||
fontset = ptr+1;
|
fontset = ptr+1;
|
||||||
} while (ptr!=NULL);
|
} while (ptr!=NULL);
|
||||||
|
|
||||||
return newfs;
|
return newfs;
|
||||||
@@ -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*
|
WMFont*
|
||||||
WMCopyFontWithChanges(WMScreen *scrPtr, WMFont *font,
|
WMCopyFontWithChanges(WMScreen *scrPtr, WMFont *font,
|
||||||
const WMFontAttributes *changes)
|
const WMFontAttributes *changes)
|
||||||
@@ -1704,9 +1605,6 @@ WMCopyFontWithChanges(WMScreen *scrPtr, WMFont *font,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// should WFANormal also set "normal" or leave it alone?
|
// should WFANormal also set "normal" or leave it alone?
|
||||||
static const WMFontAttributes W_FANormal = {
|
static const WMFontAttributes W_FANormal = {
|
||||||
WFAUnchanged, WFAUnchanged, "medium,normal,regular", "r", "normal",
|
WFAUnchanged, WFAUnchanged, "medium,normal,regular", "r", "normal",
|
||||||
@@ -1758,3 +1656,6 @@ const WMFontAttributes *WFANotEmphasized = &W_FANotEmphasized;
|
|||||||
const WMFontAttributes *WFABoldEmphasized = &W_FABoldEmphasized;
|
const WMFontAttributes *WFABoldEmphasized = &W_FABoldEmphasized;
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
194
WINGs/wframe.c
194
WINGs/wframe.c
@@ -9,8 +9,8 @@ typedef struct W_Frame {
|
|||||||
char *caption;
|
char *caption;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
WMReliefType relief:4;
|
WMReliefType relief:4;
|
||||||
WMTitlePosition titlePosition:4;
|
WMTitlePosition titlePosition:4;
|
||||||
} flags;
|
} flags;
|
||||||
} Frame;
|
} Frame;
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ WMSetFrameTitlePosition(WMFrame *fPtr, WMTitlePosition position)
|
|||||||
fPtr->flags.titlePosition = position;
|
fPtr->flags.titlePosition = position;
|
||||||
|
|
||||||
if (fPtr->view->flags.realized) {
|
if (fPtr->view->flags.realized) {
|
||||||
repaintFrame(fPtr);
|
repaintFrame(fPtr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,101 +98,101 @@ paintFrame(Frame *fPtr)
|
|||||||
|
|
||||||
fh = view->size.height;
|
fh = view->size.height;
|
||||||
fy = 0;
|
fy = 0;
|
||||||
|
|
||||||
switch (fPtr->flags.titlePosition) {
|
switch (fPtr->flags.titlePosition) {
|
||||||
case WTPAboveTop:
|
case WTPAboveTop:
|
||||||
ty = 0;
|
ty = 0;
|
||||||
fy = th + 4;
|
fy = th + 4;
|
||||||
fh = view->size.height - fy;
|
fh = view->size.height - fy;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WTPAtTop:
|
case WTPAtTop:
|
||||||
ty = 0;
|
ty = 0;
|
||||||
fy = th/2;
|
fy = th/2;
|
||||||
fh = view->size.height - fy;
|
fh = view->size.height - fy;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WTPBelowTop:
|
case WTPBelowTop:
|
||||||
ty = 4;
|
ty = 4;
|
||||||
fy = 0;
|
fy = 0;
|
||||||
fh = view->size.height;
|
fh = view->size.height;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WTPAboveBottom:
|
case WTPAboveBottom:
|
||||||
ty = view->size.height - th - 4;
|
ty = view->size.height - th - 4;
|
||||||
fy = 0;
|
fy = 0;
|
||||||
fh = view->size.height;
|
fh = view->size.height;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WTPAtBottom:
|
case WTPAtBottom:
|
||||||
ty = view->size.height - th;
|
ty = view->size.height - th;
|
||||||
fy = 0;
|
fy = 0;
|
||||||
fh = view->size.height - th/2;
|
fh = view->size.height - th/2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WTPBelowBottom:
|
case WTPBelowBottom:
|
||||||
ty = view->size.height - th;
|
ty = view->size.height - th;
|
||||||
fy = 0;
|
fy = 0;
|
||||||
fh = view->size.height - th - 4;
|
fh = view->size.height - th - 4;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ty = 0;
|
ty = 0;
|
||||||
fy = 0;
|
fy = 0;
|
||||||
fh = view->size.height;
|
fh = view->size.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tlen>0 && fPtr->flags.titlePosition!=WTPNoTitle) {
|
if (tlen>0 && fPtr->flags.titlePosition!=WTPNoTitle) {
|
||||||
tw = WMWidthOfString(font, fPtr->caption, tlen);
|
tw = WMWidthOfString(font, fPtr->caption, tlen);
|
||||||
|
|
||||||
tx = (view->size.width - tw) / 2;
|
tx = (view->size.width - tw) / 2;
|
||||||
|
|
||||||
drawTitle = True;
|
drawTitle = True;
|
||||||
} else {
|
} else {
|
||||||
drawTitle = False;
|
drawTitle = False;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
XRectangle rect;
|
XRectangle rect;
|
||||||
Region region, tmp;
|
Region region, tmp;
|
||||||
GC gc[4];
|
GC gc[4];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
region = XCreateRegion();
|
region = XCreateRegion();
|
||||||
|
|
||||||
if (drawTitle) {
|
if (drawTitle) {
|
||||||
tmp = XCreateRegion();
|
tmp = XCreateRegion();
|
||||||
rect.x = tx;
|
rect.x = tx;
|
||||||
rect.y = ty;
|
rect.y = ty;
|
||||||
rect.width = tw;
|
rect.width = tw;
|
||||||
rect.height = th;
|
rect.height = th;
|
||||||
XUnionRectWithRegion(&rect, tmp, tmp);
|
XUnionRectWithRegion(&rect, tmp, tmp);
|
||||||
}
|
}
|
||||||
rect.x = 0;
|
rect.x = 0;
|
||||||
rect.y = 0;
|
rect.y = 0;
|
||||||
rect.width = view->size.width;
|
rect.width = view->size.width;
|
||||||
rect.height = view->size.height;
|
rect.height = view->size.height;
|
||||||
XUnionRectWithRegion(&rect, region, region);
|
XUnionRectWithRegion(&rect, region, region);
|
||||||
if (drawTitle) {
|
if (drawTitle) {
|
||||||
XSubtractRegion(region, tmp, region);
|
XSubtractRegion(region, tmp, region);
|
||||||
XDestroyRegion(tmp);
|
XDestroyRegion(tmp);
|
||||||
}
|
}
|
||||||
gc[0] = WMColorGC(scrPtr->black);
|
gc[0] = WMColorGC(scrPtr->black);
|
||||||
gc[1] = WMColorGC(scrPtr->darkGray);
|
gc[1] = WMColorGC(scrPtr->darkGray);
|
||||||
gc[2] = WMColorGC(scrPtr->gray);
|
gc[2] = WMColorGC(scrPtr->gray);
|
||||||
gc[3] = WMColorGC(scrPtr->white);
|
gc[3] = WMColorGC(scrPtr->white);
|
||||||
|
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
XSetRegion(display, gc[i], region);
|
XSetRegion(display, gc[i], region);
|
||||||
}
|
}
|
||||||
XDestroyRegion(region);
|
XDestroyRegion(region);
|
||||||
|
|
||||||
W_DrawReliefWithGC(scrPtr, view->window, 0, fy, view->size.width, fh,
|
W_DrawReliefWithGC(scrPtr, view->window, 0, fy, view->size.width, fh,
|
||||||
fPtr->flags.relief, gc[0], gc[1], gc[2], gc[3]);
|
fPtr->flags.relief, gc[0], gc[1], gc[2], gc[3]);
|
||||||
|
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
XSetClipMask(display, gc[i], None);
|
XSetClipMask(display, gc[i], None);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (drawTitle) {
|
if (drawTitle) {
|
||||||
@@ -226,14 +226,14 @@ handleEvents(XEvent *event, void *data)
|
|||||||
CHECK_CLASS(data, WC_Frame);
|
CHECK_CLASS(data, WC_Frame);
|
||||||
|
|
||||||
switch (event->type) {
|
switch (event->type) {
|
||||||
case Expose:
|
case Expose:
|
||||||
if (event->xexpose.count == 0)
|
if (event->xexpose.count == 0)
|
||||||
paintFrame(fPtr);
|
paintFrame(fPtr);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DestroyNotify:
|
case DestroyNotify:
|
||||||
destroyFrame(fPtr);
|
destroyFrame(fPtr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,7 +242,7 @@ WMFrame*
|
|||||||
WMCreateFrame(WMWidget *parent)
|
WMCreateFrame(WMWidget *parent)
|
||||||
{
|
{
|
||||||
Frame *fPtr;
|
Frame *fPtr;
|
||||||
|
|
||||||
fPtr = wmalloc(sizeof(Frame));
|
fPtr = wmalloc(sizeof(Frame));
|
||||||
memset(fPtr, 0, sizeof(Frame));
|
memset(fPtr, 0, sizeof(Frame));
|
||||||
|
|
||||||
@@ -250,29 +250,29 @@ WMCreateFrame(WMWidget *parent)
|
|||||||
|
|
||||||
fPtr->view = W_CreateView(W_VIEW(parent));
|
fPtr->view = W_CreateView(W_VIEW(parent));
|
||||||
if (!fPtr->view) {
|
if (!fPtr->view) {
|
||||||
wfree(fPtr);
|
wfree(fPtr);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
fPtr->view->self = fPtr;
|
fPtr->view->self = fPtr;
|
||||||
|
|
||||||
WMCreateEventHandler(fPtr->view, ExposureMask|StructureNotifyMask,
|
WMCreateEventHandler(fPtr->view, ExposureMask|StructureNotifyMask,
|
||||||
handleEvents, fPtr);
|
handleEvents, fPtr);
|
||||||
|
|
||||||
|
|
||||||
fPtr->flags.relief = DEFAULT_RELIEF;
|
fPtr->flags.relief = DEFAULT_RELIEF;
|
||||||
fPtr->flags.titlePosition = DEFAULT_TITLE_POSITION;
|
fPtr->flags.titlePosition = DEFAULT_TITLE_POSITION;
|
||||||
|
|
||||||
WMResizeWidget(fPtr, DEFAULT_WIDTH, DEFAULT_HEIGHT);
|
WMResizeWidget(fPtr, DEFAULT_WIDTH, DEFAULT_HEIGHT);
|
||||||
|
|
||||||
return fPtr;
|
return fPtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
destroyFrame(Frame *fPtr)
|
destroyFrame(Frame *fPtr)
|
||||||
{
|
{
|
||||||
if (fPtr->caption)
|
if (fPtr->caption)
|
||||||
wfree(fPtr->caption);
|
wfree(fPtr->caption);
|
||||||
|
|
||||||
wfree(fPtr);
|
wfree(fPtr);
|
||||||
}
|
}
|
||||||
|
|||||||
408
WINGs/widgets.c
408
WINGs/widgets.c
@@ -322,8 +322,8 @@ static int userWidgetCount=0;
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
renderPixmap(W_Screen *screen, Pixmap d, Pixmap mask, char **data,
|
renderPixmap(W_Screen *screen, Pixmap d, Pixmap mask, char **data,
|
||||||
int width, int height)
|
int width, int height)
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
GC whiteGC = WMColorGC(screen->white);
|
GC whiteGC = WMColorGC(screen->white);
|
||||||
@@ -333,37 +333,37 @@ renderPixmap(W_Screen *screen, Pixmap d, Pixmap mask, char **data,
|
|||||||
|
|
||||||
|
|
||||||
if (mask)
|
if (mask)
|
||||||
XSetForeground(screen->display, screen->monoGC, 0);
|
XSetForeground(screen->display, screen->monoGC, 0);
|
||||||
|
|
||||||
for (y = 0; y < height; y++) {
|
|
||||||
for (x = 0; x < width; x++) {
|
|
||||||
switch (data[y][x]) {
|
|
||||||
case ' ':
|
|
||||||
case 'w':
|
|
||||||
XDrawPoint(screen->display, d, whiteGC, x, y);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '=':
|
for (y = 0; y < height; y++) {
|
||||||
if (mask)
|
for (x = 0; x < width; x++) {
|
||||||
XDrawPoint(screen->display, mask, screen->monoGC, x, y);
|
switch (data[y][x]) {
|
||||||
|
case ' ':
|
||||||
case '.':
|
case 'w':
|
||||||
case 'l':
|
XDrawPoint(screen->display, d, whiteGC, x, y);
|
||||||
XDrawPoint(screen->display, d, lightGC, x, y);
|
break;
|
||||||
break;
|
|
||||||
|
case '=':
|
||||||
case '%':
|
if (mask)
|
||||||
case 'd':
|
XDrawPoint(screen->display, mask, screen->monoGC, x, y);
|
||||||
XDrawPoint(screen->display, d, darkGC, x, y);
|
|
||||||
break;
|
case '.':
|
||||||
|
case 'l':
|
||||||
case '#':
|
XDrawPoint(screen->display, d, lightGC, x, y);
|
||||||
case 'b':
|
break;
|
||||||
default:
|
|
||||||
XDrawPoint(screen->display, d, blackGC, x, y);
|
case '%':
|
||||||
break;
|
case 'd':
|
||||||
}
|
XDrawPoint(screen->display, d, darkGC, x, y);
|
||||||
}
|
break;
|
||||||
|
|
||||||
|
case '#':
|
||||||
|
case 'b':
|
||||||
|
default:
|
||||||
|
XDrawPoint(screen->display, d, blackGC, x, y);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -373,20 +373,20 @@ static WMPixmap*
|
|||||||
makePixmap(W_Screen *sPtr, char **data, int width, int height, int masked)
|
makePixmap(W_Screen *sPtr, char **data, int width, int height, int masked)
|
||||||
{
|
{
|
||||||
Pixmap pixmap, mask = None;
|
Pixmap pixmap, mask = None;
|
||||||
|
|
||||||
pixmap = XCreatePixmap(sPtr->display, W_DRAWABLE(sPtr), width, height,
|
pixmap = XCreatePixmap(sPtr->display, W_DRAWABLE(sPtr), width, height,
|
||||||
sPtr->depth);
|
sPtr->depth);
|
||||||
|
|
||||||
if (masked) {
|
if (masked) {
|
||||||
mask = XCreatePixmap(sPtr->display, W_DRAWABLE(sPtr), width, height, 1);
|
mask = XCreatePixmap(sPtr->display, W_DRAWABLE(sPtr), width, height, 1);
|
||||||
XSetForeground(sPtr->display, sPtr->monoGC, 1);
|
XSetForeground(sPtr->display, sPtr->monoGC, 1);
|
||||||
XFillRectangle(sPtr->display, mask, sPtr->monoGC, 0, 0, width, height);
|
XFillRectangle(sPtr->display, mask, sPtr->monoGC, 0, 0, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
renderPixmap(sPtr, pixmap, mask, data, width, height);
|
renderPixmap(sPtr, pixmap, mask, data, width, height);
|
||||||
|
|
||||||
return WMCreatePixmapFromXPixmaps(sPtr, pixmap, mask, width, height,
|
return WMCreatePixmapFromXPixmaps(sPtr, pixmap, mask, width, height,
|
||||||
sPtr->depth);
|
sPtr->depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -414,11 +414,11 @@ loadPixmaps(WMScreen *scr)
|
|||||||
|
|
||||||
image = RLoadImage(scr->rcontext, T_WINGS_IMAGES_FILE, 0);
|
image = RLoadImage(scr->rcontext, T_WINGS_IMAGES_FILE, 0);
|
||||||
if (!image)
|
if (!image)
|
||||||
image = RLoadImage(scr->rcontext, X_WINGS_IMAGES_FILE, 0);
|
image = RLoadImage(scr->rcontext, X_WINGS_IMAGES_FILE, 0);
|
||||||
if (!image) {
|
if (!image) {
|
||||||
wwarning(_("WINGs: could not load widget images file: %s"),
|
wwarning(_("WINGs: could not load widget images file: %s"),
|
||||||
RMessageForError(RErrorCode));
|
RMessageForError(RErrorCode));
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
/* home icon */
|
/* home icon */
|
||||||
/* make it have a gray background */
|
/* make it have a gray background */
|
||||||
@@ -502,19 +502,19 @@ loadPixmaps(WMScreen *scr)
|
|||||||
tmp = RGetSubImage(image, 41, 57, 40, 24);
|
tmp = RGetSubImage(image, 41, 57, 40, 24);
|
||||||
scr->colorListIcon = WMCreatePixmapFromRImage(scr, tmp, 128);
|
scr->colorListIcon = WMCreatePixmapFromRImage(scr, tmp, 128);
|
||||||
RReleaseImage(tmp);
|
RReleaseImage(tmp);
|
||||||
|
|
||||||
RReleaseImage(image);
|
RReleaseImage(image);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
scr->defaultObjectIcon =
|
scr->defaultObjectIcon =
|
||||||
WMCreatePixmapFromFile(scr, T_DEFAULT_OBJECT_ICON_FILE);
|
WMCreatePixmapFromFile(scr, T_DEFAULT_OBJECT_ICON_FILE);
|
||||||
if (!scr->defaultObjectIcon) {
|
if (!scr->defaultObjectIcon) {
|
||||||
scr->defaultObjectIcon =
|
scr->defaultObjectIcon =
|
||||||
WMCreatePixmapFromFile(scr, X_DEFAULT_OBJECT_ICON_FILE);
|
WMCreatePixmapFromFile(scr, X_DEFAULT_OBJECT_ICON_FILE);
|
||||||
}
|
}
|
||||||
if (!scr->defaultObjectIcon) {
|
if (!scr->defaultObjectIcon) {
|
||||||
wwarning("WINGs: could not load default icon file");
|
wwarning("WINGs: could not load default icon file");
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return True;
|
return True;
|
||||||
@@ -525,13 +525,13 @@ WMScreen*
|
|||||||
WMOpenScreen(const char *display)
|
WMOpenScreen(const char *display)
|
||||||
{
|
{
|
||||||
Display *dpy = XOpenDisplay(display);
|
Display *dpy = XOpenDisplay(display);
|
||||||
|
|
||||||
if (!dpy) {
|
if (!dpy) {
|
||||||
wwarning("WINGs: could not open display %s",
|
wwarning("WINGs: could not open display %s",
|
||||||
XDisplayName(display));
|
XDisplayName(display));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return WMCreateSimpleApplicationScreen(dpy);
|
return WMCreateSimpleApplicationScreen(dpy);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -540,12 +540,12 @@ WMScreen*
|
|||||||
WMCreateSimpleApplicationScreen(Display *display)
|
WMCreateSimpleApplicationScreen(Display *display)
|
||||||
{
|
{
|
||||||
WMScreen *scr;
|
WMScreen *scr;
|
||||||
|
|
||||||
scr = WMCreateScreen(display, DefaultScreen(display));
|
scr = WMCreateScreen(display, DefaultScreen(display));
|
||||||
|
|
||||||
scr->aflags.hasAppIcon = 0;
|
scr->aflags.hasAppIcon = 0;
|
||||||
scr->aflags.simpleApplication = 1;
|
scr->aflags.simpleApplication = 1;
|
||||||
|
|
||||||
return scr;
|
return scr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -555,7 +555,7 @@ WMScreen*
|
|||||||
WMCreateScreen(Display *display, int screen)
|
WMCreateScreen(Display *display, int screen)
|
||||||
{
|
{
|
||||||
return WMCreateScreenWithRContext(display, screen,
|
return WMCreateScreenWithRContext(display, screen,
|
||||||
RCreateContext(display, screen, NULL));
|
RCreateContext(display, screen, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -567,46 +567,48 @@ WMCreateScreenWithRContext(Display *display, int screen, RContext *context)
|
|||||||
Pixmap stipple;
|
Pixmap stipple;
|
||||||
static int initialized = 0;
|
static int initialized = 0;
|
||||||
static char *atomNames[] = {
|
static char *atomNames[] = {
|
||||||
"_GNUSTEP_WM_ATTR",
|
"_GNUSTEP_WM_ATTR",
|
||||||
"WM_DELETE_WINDOW",
|
"WM_DELETE_WINDOW",
|
||||||
"WM_PROTOCOLS",
|
"WM_PROTOCOLS",
|
||||||
"CLIPBOARD",
|
"CLIPBOARD",
|
||||||
"XdndAware",
|
"XdndAware",
|
||||||
"XdndSelection",
|
"XdndSelection",
|
||||||
"XdndEnter",
|
"XdndEnter",
|
||||||
"XdndLeave",
|
"XdndLeave",
|
||||||
"XdndPosition",
|
"XdndPosition",
|
||||||
"XdndDrop",
|
"XdndDrop",
|
||||||
"XdndFinished",
|
"XdndFinished",
|
||||||
"XdndTypeList",
|
"XdndTypeList",
|
||||||
"XdndActionCopy",
|
"XdndActionList",
|
||||||
"XdndActionMove",
|
"XdndActionDescription",
|
||||||
"XdndActionLink",
|
"XdndStatus",
|
||||||
"XdndActionAsk",
|
"XdndActionCopy",
|
||||||
"XdndActionPrivate",
|
"XdndActionMove",
|
||||||
"XdndStatus",
|
"XdndActionLink",
|
||||||
"_WINGS_DND_MOUSE_OFFSET",
|
"XdndActionAsk",
|
||||||
"WM_STATE"
|
"XdndActionPrivate",
|
||||||
|
"_WINGS_DND_MOUSE_OFFSET",
|
||||||
|
"WM_STATE"
|
||||||
};
|
};
|
||||||
Atom atoms[sizeof(atomNames)/sizeof(char*)];
|
Atom atoms[sizeof(atomNames)/sizeof(char*)];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
|
|
||||||
initialized = 1;
|
initialized = 1;
|
||||||
|
|
||||||
W_ReadConfigurations();
|
W_ReadConfigurations();
|
||||||
|
|
||||||
assert(W_ApplicationInitialized());
|
assert(W_ApplicationInitialized());
|
||||||
}
|
}
|
||||||
|
|
||||||
scrPtr = malloc(sizeof(W_Screen));
|
scrPtr = malloc(sizeof(W_Screen));
|
||||||
if (!scrPtr)
|
if (!scrPtr)
|
||||||
return NULL;
|
return NULL;
|
||||||
memset(scrPtr, 0, sizeof(W_Screen));
|
memset(scrPtr, 0, sizeof(W_Screen));
|
||||||
|
|
||||||
scrPtr->aflags.hasAppIcon = 1;
|
scrPtr->aflags.hasAppIcon = 1;
|
||||||
|
|
||||||
scrPtr->display = display;
|
scrPtr->display = display;
|
||||||
scrPtr->screen = screen;
|
scrPtr->screen = screen;
|
||||||
scrPtr->rcontext = context;
|
scrPtr->rcontext = context;
|
||||||
@@ -671,77 +673,77 @@ WMCreateScreenWithRContext(Display *display, int screen, RContext *context)
|
|||||||
|
|
||||||
scrPtr->ignoredModifierMask = 0;
|
scrPtr->ignoredModifierMask = 0;
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
XModifierKeymap *modmap;
|
XModifierKeymap *modmap;
|
||||||
KeyCode nlock, slock;
|
KeyCode nlock, slock;
|
||||||
static int mask_table[8] = {
|
static int mask_table[8] = {
|
||||||
ShiftMask,LockMask,ControlMask,Mod1Mask,
|
ShiftMask,LockMask,ControlMask,Mod1Mask,
|
||||||
Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask
|
Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask
|
||||||
};
|
};
|
||||||
unsigned int numLockMask=0, scrollLockMask=0;
|
unsigned int numLockMask=0, scrollLockMask=0;
|
||||||
|
|
||||||
nlock = XKeysymToKeycode(display, XK_Num_Lock);
|
nlock = XKeysymToKeycode(display, XK_Num_Lock);
|
||||||
slock = XKeysymToKeycode(display, XK_Scroll_Lock);
|
slock = XKeysymToKeycode(display, XK_Scroll_Lock);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Find out the masks for the NumLock and ScrollLock modifiers,
|
* Find out the masks for the NumLock and ScrollLock modifiers,
|
||||||
* so that we can bind the grabs for when they are enabled too.
|
* so that we can bind the grabs for when they are enabled too.
|
||||||
*/
|
*/
|
||||||
modmap = XGetModifierMapping(display);
|
modmap = XGetModifierMapping(display);
|
||||||
|
|
||||||
if (modmap!=NULL && modmap->max_keypermod>0) {
|
if (modmap!=NULL && modmap->max_keypermod>0) {
|
||||||
for (i=0; i<8*modmap->max_keypermod; i++) {
|
for (i=0; i<8*modmap->max_keypermod; i++) {
|
||||||
if (modmap->modifiermap[i]==nlock && nlock!=0)
|
if (modmap->modifiermap[i]==nlock && nlock!=0)
|
||||||
numLockMask = mask_table[i/modmap->max_keypermod];
|
numLockMask = mask_table[i/modmap->max_keypermod];
|
||||||
else if (modmap->modifiermap[i]==slock && slock!=0)
|
else if (modmap->modifiermap[i]==slock && slock!=0)
|
||||||
scrollLockMask = mask_table[i/modmap->max_keypermod];
|
scrollLockMask = mask_table[i/modmap->max_keypermod];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (modmap)
|
if (modmap)
|
||||||
XFreeModifiermap(modmap);
|
XFreeModifiermap(modmap);
|
||||||
|
|
||||||
|
|
||||||
scrPtr->ignoredModifierMask = numLockMask|scrollLockMask|LockMask;
|
scrPtr->ignoredModifierMask = numLockMask|scrollLockMask|LockMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initially allocate some colors */
|
/* initially allocate some colors */
|
||||||
WMWhiteColor(scrPtr);
|
WMWhiteColor(scrPtr);
|
||||||
WMBlackColor(scrPtr);
|
WMBlackColor(scrPtr);
|
||||||
WMGrayColor(scrPtr);
|
WMGrayColor(scrPtr);
|
||||||
WMDarkGrayColor(scrPtr);
|
WMDarkGrayColor(scrPtr);
|
||||||
|
|
||||||
gcv.graphics_exposures = False;
|
gcv.graphics_exposures = False;
|
||||||
|
|
||||||
gcv.function = GXxor;
|
gcv.function = GXxor;
|
||||||
gcv.foreground = W_PIXEL(scrPtr->white);
|
gcv.foreground = W_PIXEL(scrPtr->white);
|
||||||
if (gcv.foreground == 0) gcv.foreground = 1;
|
if (gcv.foreground == 0) gcv.foreground = 1;
|
||||||
scrPtr->xorGC = XCreateGC(display, W_DRAWABLE(scrPtr), GCFunction
|
scrPtr->xorGC = XCreateGC(display, W_DRAWABLE(scrPtr), GCFunction
|
||||||
|GCGraphicsExposures|GCForeground, &gcv);
|
|GCGraphicsExposures|GCForeground, &gcv);
|
||||||
|
|
||||||
gcv.function = GXxor;
|
gcv.function = GXxor;
|
||||||
gcv.foreground = W_PIXEL(scrPtr->gray);
|
gcv.foreground = W_PIXEL(scrPtr->gray);
|
||||||
gcv.subwindow_mode = IncludeInferiors;
|
gcv.subwindow_mode = IncludeInferiors;
|
||||||
scrPtr->ixorGC = XCreateGC(display, W_DRAWABLE(scrPtr), GCFunction
|
scrPtr->ixorGC = XCreateGC(display, W_DRAWABLE(scrPtr), GCFunction
|
||||||
|GCGraphicsExposures|GCForeground
|
|GCGraphicsExposures|GCForeground
|
||||||
|GCSubwindowMode, &gcv);
|
|GCSubwindowMode, &gcv);
|
||||||
|
|
||||||
gcv.function = GXcopy;
|
gcv.function = GXcopy;
|
||||||
scrPtr->copyGC = XCreateGC(display, W_DRAWABLE(scrPtr), GCFunction
|
scrPtr->copyGC = XCreateGC(display, W_DRAWABLE(scrPtr), GCFunction
|
||||||
|GCGraphicsExposures, &gcv);
|
|GCGraphicsExposures, &gcv);
|
||||||
|
|
||||||
scrPtr->clipGC = XCreateGC(display, W_DRAWABLE(scrPtr), GCFunction
|
scrPtr->clipGC = XCreateGC(display, W_DRAWABLE(scrPtr), GCFunction
|
||||||
|GCGraphicsExposures, &gcv);
|
|GCGraphicsExposures, &gcv);
|
||||||
|
|
||||||
stipple = XCreateBitmapFromData(display, W_DRAWABLE(scrPtr),
|
stipple = XCreateBitmapFromData(display, W_DRAWABLE(scrPtr),
|
||||||
STIPPLE_BITS, STIPPLE_WIDTH, STIPPLE_HEIGHT);
|
STIPPLE_BITS, STIPPLE_WIDTH, STIPPLE_HEIGHT);
|
||||||
gcv.foreground = W_PIXEL(scrPtr->darkGray);
|
gcv.foreground = W_PIXEL(scrPtr->darkGray);
|
||||||
gcv.background = W_PIXEL(scrPtr->gray);
|
gcv.background = W_PIXEL(scrPtr->gray);
|
||||||
gcv.fill_style = FillStippled;
|
gcv.fill_style = FillStippled;
|
||||||
gcv.stipple = stipple;
|
gcv.stipple = stipple;
|
||||||
scrPtr->stippleGC = XCreateGC(display, W_DRAWABLE(scrPtr),
|
scrPtr->stippleGC = XCreateGC(display, W_DRAWABLE(scrPtr),
|
||||||
GCForeground|GCBackground|GCStipple
|
GCForeground|GCBackground|GCStipple
|
||||||
|GCFillStyle|GCGraphicsExposures, &gcv);
|
|GCFillStyle|GCGraphicsExposures, &gcv);
|
||||||
|
|
||||||
scrPtr->drawStringGC = XCreateGC(display, W_DRAWABLE(scrPtr),
|
scrPtr->drawStringGC = XCreateGC(display, W_DRAWABLE(scrPtr),
|
||||||
GCGraphicsExposures, &gcv);
|
GCGraphicsExposures, &gcv);
|
||||||
@@ -759,67 +761,67 @@ WMCreateScreenWithRContext(Display *display, int screen, RContext *context)
|
|||||||
|
|
||||||
scrPtr->antialiasedText = WINGsConfiguration.antialiasedText;
|
scrPtr->antialiasedText = WINGsConfiguration.antialiasedText;
|
||||||
|
|
||||||
scrPtr->normalFont = WMSystemFontOfSize(scrPtr,
|
scrPtr->normalFont = WMSystemFontOfSize(scrPtr,
|
||||||
WINGsConfiguration.defaultFontSize);
|
WINGsConfiguration.defaultFontSize);
|
||||||
|
|
||||||
scrPtr->boldFont = WMBoldSystemFontOfSize(scrPtr,
|
scrPtr->boldFont = WMBoldSystemFontOfSize(scrPtr,
|
||||||
WINGsConfiguration.defaultFontSize);
|
WINGsConfiguration.defaultFontSize);
|
||||||
|
|
||||||
if (!scrPtr->boldFont)
|
if (!scrPtr->boldFont)
|
||||||
scrPtr->boldFont = scrPtr->normalFont;
|
scrPtr->boldFont = scrPtr->normalFont;
|
||||||
|
|
||||||
if (!scrPtr->normalFont) {
|
if (!scrPtr->normalFont) {
|
||||||
wwarning(_("could not load any fonts. Make sure your font installation"
|
wwarning(_("could not load any fonts. Make sure your font installation"
|
||||||
" and locale settings are correct."));
|
" and locale settings are correct."));
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
scrPtr->checkButtonImageOn = makePixmap(scrPtr, CHECK_BUTTON_ON,
|
scrPtr->checkButtonImageOn = makePixmap(scrPtr, CHECK_BUTTON_ON,
|
||||||
CHECK_BUTTON_ON_WIDTH,
|
CHECK_BUTTON_ON_WIDTH,
|
||||||
CHECK_BUTTON_ON_HEIGHT, False);
|
CHECK_BUTTON_ON_HEIGHT, False);
|
||||||
|
|
||||||
scrPtr->checkButtonImageOff = makePixmap(scrPtr, CHECK_BUTTON_OFF,
|
scrPtr->checkButtonImageOff = makePixmap(scrPtr, CHECK_BUTTON_OFF,
|
||||||
CHECK_BUTTON_OFF_WIDTH,
|
CHECK_BUTTON_OFF_WIDTH,
|
||||||
CHECK_BUTTON_OFF_HEIGHT, False);
|
CHECK_BUTTON_OFF_HEIGHT, False);
|
||||||
|
|
||||||
scrPtr->radioButtonImageOn = makePixmap(scrPtr, RADIO_BUTTON_ON,
|
scrPtr->radioButtonImageOn = makePixmap(scrPtr, RADIO_BUTTON_ON,
|
||||||
RADIO_BUTTON_ON_WIDTH,
|
RADIO_BUTTON_ON_WIDTH,
|
||||||
RADIO_BUTTON_ON_HEIGHT, False);
|
RADIO_BUTTON_ON_HEIGHT, False);
|
||||||
|
|
||||||
scrPtr->radioButtonImageOff = makePixmap(scrPtr, RADIO_BUTTON_OFF,
|
scrPtr->radioButtonImageOff = makePixmap(scrPtr, RADIO_BUTTON_OFF,
|
||||||
RADIO_BUTTON_OFF_WIDTH,
|
RADIO_BUTTON_OFF_WIDTH,
|
||||||
RADIO_BUTTON_OFF_HEIGHT, False);
|
RADIO_BUTTON_OFF_HEIGHT, False);
|
||||||
|
|
||||||
scrPtr->buttonArrow = makePixmap(scrPtr, BUTTON_ARROW,
|
scrPtr->buttonArrow = makePixmap(scrPtr, BUTTON_ARROW,
|
||||||
BUTTON_ARROW_WIDTH, BUTTON_ARROW_HEIGHT,
|
BUTTON_ARROW_WIDTH, BUTTON_ARROW_HEIGHT,
|
||||||
False);
|
False);
|
||||||
|
|
||||||
scrPtr->pushedButtonArrow = makePixmap(scrPtr, BUTTON_ARROW2,
|
scrPtr->pushedButtonArrow = makePixmap(scrPtr, BUTTON_ARROW2,
|
||||||
BUTTON_ARROW2_WIDTH, BUTTON_ARROW2_HEIGHT,
|
BUTTON_ARROW2_WIDTH, BUTTON_ARROW2_HEIGHT,
|
||||||
False);
|
False);
|
||||||
|
|
||||||
|
|
||||||
scrPtr->scrollerDimple = makePixmap(scrPtr, SCROLLER_DIMPLE,
|
scrPtr->scrollerDimple = makePixmap(scrPtr, SCROLLER_DIMPLE,
|
||||||
SCROLLER_DIMPLE_WIDTH,
|
SCROLLER_DIMPLE_WIDTH,
|
||||||
SCROLLER_DIMPLE_HEIGHT, False);
|
SCROLLER_DIMPLE_HEIGHT, False);
|
||||||
|
|
||||||
|
|
||||||
scrPtr->upArrow = makePixmap(scrPtr, SCROLLER_ARROW_UP,
|
scrPtr->upArrow = makePixmap(scrPtr, SCROLLER_ARROW_UP,
|
||||||
SCROLLER_ARROW_UP_WIDTH,
|
SCROLLER_ARROW_UP_WIDTH,
|
||||||
SCROLLER_ARROW_UP_HEIGHT, True);
|
SCROLLER_ARROW_UP_HEIGHT, True);
|
||||||
|
|
||||||
scrPtr->downArrow = makePixmap(scrPtr, SCROLLER_ARROW_DOWN,
|
scrPtr->downArrow = makePixmap(scrPtr, SCROLLER_ARROW_DOWN,
|
||||||
SCROLLER_ARROW_DOWN_WIDTH,
|
SCROLLER_ARROW_DOWN_WIDTH,
|
||||||
SCROLLER_ARROW_DOWN_HEIGHT, True);
|
SCROLLER_ARROW_DOWN_HEIGHT, True);
|
||||||
|
|
||||||
scrPtr->leftArrow = makePixmap(scrPtr, SCROLLER_ARROW_LEFT,
|
scrPtr->leftArrow = makePixmap(scrPtr, SCROLLER_ARROW_LEFT,
|
||||||
SCROLLER_ARROW_LEFT_WIDTH,
|
SCROLLER_ARROW_LEFT_WIDTH,
|
||||||
SCROLLER_ARROW_LEFT_HEIGHT, True);
|
SCROLLER_ARROW_LEFT_HEIGHT, True);
|
||||||
|
|
||||||
scrPtr->rightArrow = makePixmap(scrPtr, SCROLLER_ARROW_RIGHT,
|
scrPtr->rightArrow = makePixmap(scrPtr, SCROLLER_ARROW_RIGHT,
|
||||||
SCROLLER_ARROW_RIGHT_WIDTH,
|
SCROLLER_ARROW_RIGHT_WIDTH,
|
||||||
SCROLLER_ARROW_RIGHT_HEIGHT, True);
|
SCROLLER_ARROW_RIGHT_HEIGHT, True);
|
||||||
|
|
||||||
scrPtr->hiUpArrow = makePixmap(scrPtr, HI_SCROLLER_ARROW_UP,
|
scrPtr->hiUpArrow = makePixmap(scrPtr, HI_SCROLLER_ARROW_UP,
|
||||||
SCROLLER_ARROW_UP_WIDTH,
|
SCROLLER_ARROW_UP_WIDTH,
|
||||||
@@ -838,16 +840,16 @@ WMCreateScreenWithRContext(Display *display, int screen, RContext *context)
|
|||||||
SCROLLER_ARROW_RIGHT_HEIGHT, True);
|
SCROLLER_ARROW_RIGHT_HEIGHT, True);
|
||||||
|
|
||||||
scrPtr->popUpIndicator = makePixmap(scrPtr, POPUP_INDICATOR,
|
scrPtr->popUpIndicator = makePixmap(scrPtr, POPUP_INDICATOR,
|
||||||
POPUP_INDICATOR_WIDTH,
|
POPUP_INDICATOR_WIDTH,
|
||||||
POPUP_INDICATOR_HEIGHT, True);
|
POPUP_INDICATOR_HEIGHT, True);
|
||||||
|
|
||||||
scrPtr->pullDownIndicator = makePixmap(scrPtr, PULLDOWN_INDICATOR,
|
scrPtr->pullDownIndicator = makePixmap(scrPtr, PULLDOWN_INDICATOR,
|
||||||
PULLDOWN_INDICATOR_WIDTH,
|
PULLDOWN_INDICATOR_WIDTH,
|
||||||
PULLDOWN_INDICATOR_HEIGHT, True);
|
PULLDOWN_INDICATOR_HEIGHT, True);
|
||||||
|
|
||||||
scrPtr->checkMark = makePixmap(scrPtr, CHECK_MARK,
|
scrPtr->checkMark = makePixmap(scrPtr, CHECK_MARK,
|
||||||
CHECK_MARK_WIDTH,
|
CHECK_MARK_WIDTH,
|
||||||
CHECK_MARK_HEIGHT, True);
|
CHECK_MARK_HEIGHT, True);
|
||||||
|
|
||||||
loadPixmaps(scrPtr);
|
loadPixmaps(scrPtr);
|
||||||
|
|
||||||
@@ -856,21 +858,21 @@ WMCreateScreenWithRContext(Display *display, int screen, RContext *context)
|
|||||||
scrPtr->textCursor = XCreateFontCursor(display, XC_xterm);
|
scrPtr->textCursor = XCreateFontCursor(display, XC_xterm);
|
||||||
|
|
||||||
{
|
{
|
||||||
XColor bla;
|
XColor bla;
|
||||||
Pixmap blank;
|
Pixmap blank;
|
||||||
|
|
||||||
blank = XCreatePixmap(display, scrPtr->stipple, 1, 1, 1);
|
blank = XCreatePixmap(display, scrPtr->stipple, 1, 1, 1);
|
||||||
XSetForeground(display, scrPtr->monoGC, 0);
|
XSetForeground(display, scrPtr->monoGC, 0);
|
||||||
XFillRectangle(display, blank, scrPtr->monoGC, 0, 0, 1, 1);
|
XFillRectangle(display, blank, scrPtr->monoGC, 0, 0, 1, 1);
|
||||||
|
|
||||||
scrPtr->invisibleCursor = XCreatePixmapCursor(display, blank, blank,
|
scrPtr->invisibleCursor = XCreatePixmapCursor(display, blank, blank,
|
||||||
&bla, &bla, 0, 0);
|
&bla, &bla, 0, 0);
|
||||||
XFreePixmap(display, blank);
|
XFreePixmap(display, blank);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_XINTERNATOMS
|
#ifdef HAVE_XINTERNATOMS
|
||||||
XInternAtoms(display, atomNames, sizeof(atomNames)/sizeof(char*), False,
|
XInternAtoms(display, atomNames, sizeof(atomNames)/sizeof(char*), False,
|
||||||
atoms);
|
atoms);
|
||||||
#else
|
#else
|
||||||
for (i = 0; i < sizeof(atomNames)/sizeof(char*); i++) {
|
for (i = 0; i < sizeof(atomNames)/sizeof(char*); i++) {
|
||||||
atoms[i] = XInternAtom(display, atomNames[i], False);
|
atoms[i] = XInternAtom(display, atomNames[i], False);
|
||||||
@@ -883,7 +885,7 @@ WMCreateScreenWithRContext(Display *display, int screen, RContext *context)
|
|||||||
scrPtr->deleteWindowAtom = atoms[i++];
|
scrPtr->deleteWindowAtom = atoms[i++];
|
||||||
|
|
||||||
scrPtr->protocolsAtom = atoms[i++];
|
scrPtr->protocolsAtom = atoms[i++];
|
||||||
|
|
||||||
scrPtr->clipboardAtom = atoms[i++];
|
scrPtr->clipboardAtom = atoms[i++];
|
||||||
|
|
||||||
scrPtr->xdndAwareAtom = atoms[i++];
|
scrPtr->xdndAwareAtom = atoms[i++];
|
||||||
@@ -894,6 +896,8 @@ WMCreateScreenWithRContext(Display *display, int screen, RContext *context)
|
|||||||
scrPtr->xdndDropAtom = atoms[i++];
|
scrPtr->xdndDropAtom = atoms[i++];
|
||||||
scrPtr->xdndFinishedAtom = atoms[i++];
|
scrPtr->xdndFinishedAtom = atoms[i++];
|
||||||
scrPtr->xdndTypeListAtom = atoms[i++];
|
scrPtr->xdndTypeListAtom = atoms[i++];
|
||||||
|
scrPtr->xdndActionListAtom = atoms[i++];
|
||||||
|
scrPtr->xdndActionDescriptionAtom = atoms[i++];
|
||||||
scrPtr->xdndStatusAtom = atoms[i++];
|
scrPtr->xdndStatusAtom = atoms[i++];
|
||||||
|
|
||||||
scrPtr->xdndActionCopy = atoms[i++];
|
scrPtr->xdndActionCopy = atoms[i++];
|
||||||
@@ -935,7 +939,7 @@ WMSetWidgetDefaultBoldFont(WMScreen *scr, WMFont *font)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WMHangData(WMWidget *widget, void *data)
|
WMHangData(WMWidget *widget, void *data)
|
||||||
{
|
{
|
||||||
W_VIEW(widget)->hangedData = data;
|
W_VIEW(widget)->hangedData = data;
|
||||||
@@ -968,7 +972,7 @@ WMSetFocusToWidget(WMWidget *widget)
|
|||||||
/*
|
/*
|
||||||
* WMRealizeWidget-
|
* WMRealizeWidget-
|
||||||
* Realizes the widget and all it's children.
|
* Realizes the widget and all it's children.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
WMRealizeWidget(WMWidget *w)
|
WMRealizeWidget(WMWidget *w)
|
||||||
@@ -978,7 +982,7 @@ WMRealizeWidget(WMWidget *w)
|
|||||||
|
|
||||||
void
|
void
|
||||||
WMMapWidget(WMWidget *w)
|
WMMapWidget(WMWidget *w)
|
||||||
{
|
{
|
||||||
W_MapView(W_VIEW(w));
|
W_MapView(W_VIEW(w));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -994,36 +998,36 @@ static void
|
|||||||
makeChildrenAutomap(W_View *view, int flag)
|
makeChildrenAutomap(W_View *view, int flag)
|
||||||
{
|
{
|
||||||
view = view->childrenList;
|
view = view->childrenList;
|
||||||
|
|
||||||
while (view) {
|
while (view) {
|
||||||
view->flags.mapWhenRealized = flag;
|
view->flags.mapWhenRealized = flag;
|
||||||
makeChildrenAutomap(view, flag);
|
makeChildrenAutomap(view, flag);
|
||||||
|
|
||||||
view = view->nextSister;
|
view = view->nextSister;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WMMapSubwidgets(WMWidget *w)
|
WMMapSubwidgets(WMWidget *w)
|
||||||
{
|
{
|
||||||
/* make sure that subwidgets created after the parent was realized
|
/* make sure that subwidgets created after the parent was realized
|
||||||
* are mapped too */
|
* are mapped too */
|
||||||
if (!W_VIEW(w)->flags.realized) {
|
if (!W_VIEW(w)->flags.realized) {
|
||||||
makeChildrenAutomap(W_VIEW(w), True);
|
makeChildrenAutomap(W_VIEW(w), True);
|
||||||
} else {
|
} else {
|
||||||
W_MapSubviews(W_VIEW(w));
|
W_MapSubviews(W_VIEW(w));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WMUnmapSubwidgets(WMWidget *w)
|
WMUnmapSubwidgets(WMWidget *w)
|
||||||
{
|
{
|
||||||
if (!W_VIEW(w)->flags.realized) {
|
if (!W_VIEW(w)->flags.realized) {
|
||||||
makeChildrenAutomap(W_VIEW(w), False);
|
makeChildrenAutomap(W_VIEW(w), False);
|
||||||
} else {
|
} else {
|
||||||
W_UnmapSubviews(W_VIEW(w));
|
W_UnmapSubviews(W_VIEW(w));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1031,7 +1035,7 @@ WMUnmapSubwidgets(WMWidget *w)
|
|||||||
|
|
||||||
void
|
void
|
||||||
WMUnmapWidget(WMWidget *w)
|
WMUnmapWidget(WMWidget *w)
|
||||||
{
|
{
|
||||||
W_UnmapView(W_VIEW(w));
|
W_UnmapView(W_VIEW(w));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1048,7 +1052,7 @@ WMSetWidgetBackgroundColor(WMWidget *w, WMColor *color)
|
|||||||
{
|
{
|
||||||
W_SetViewBackgroundColor(W_VIEW(w), color);
|
W_SetViewBackgroundColor(W_VIEW(w), color);
|
||||||
if (W_VIEW(w)->flags.mapped)
|
if (W_VIEW(w)->flags.mapped)
|
||||||
WMRedisplayWidget(w);
|
WMRedisplayWidget(w);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1062,14 +1066,14 @@ WMGetWidgetBackgroundColor(WMWidget *w)
|
|||||||
void
|
void
|
||||||
WMRaiseWidget(WMWidget *w)
|
WMRaiseWidget(WMWidget *w)
|
||||||
{
|
{
|
||||||
W_RaiseView(W_VIEW(w));
|
W_RaiseView(W_VIEW(w));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WMLowerWidget(WMWidget *w)
|
WMLowerWidget(WMWidget *w)
|
||||||
{
|
{
|
||||||
W_LowerView(W_VIEW(w));
|
W_LowerView(W_VIEW(w));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1106,7 +1110,7 @@ WMScreenRContext(WMScreen *scr)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
unsigned int
|
unsigned int
|
||||||
WMWidgetWidth(WMWidget *w)
|
WMWidgetWidth(WMWidget *w)
|
||||||
{
|
{
|
||||||
return W_VIEW(w)->size.width;
|
return W_VIEW(w)->size.width;
|
||||||
@@ -1139,10 +1143,10 @@ void
|
|||||||
WMScreenMainLoop(WMScreen *scr)
|
WMScreenMainLoop(WMScreen *scr)
|
||||||
{
|
{
|
||||||
XEvent event;
|
XEvent event;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
WMNextEvent(scr->display, &event);
|
WMNextEvent(scr->display, &event);
|
||||||
WMHandleEvent(&event);
|
WMHandleEvent(&event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1166,10 +1170,10 @@ WMRunModalLoop(WMScreen *scr, WMView *view)
|
|||||||
|
|
||||||
scr->modalLoop = 1;
|
scr->modalLoop = 1;
|
||||||
while (scr->modalLoop) {
|
while (scr->modalLoop) {
|
||||||
XEvent event;
|
XEvent event;
|
||||||
|
|
||||||
WMNextEvent(scr->display, &event);
|
WMNextEvent(scr->display, &event);
|
||||||
WMHandleEvent(&event);
|
WMHandleEvent(&event);
|
||||||
}
|
}
|
||||||
|
|
||||||
scr->modalView = oldModalView;
|
scr->modalView = oldModalView;
|
||||||
@@ -1184,14 +1188,14 @@ WMScreenDisplay(WMScreen *scr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
WMScreenDepth(WMScreen *scr)
|
WMScreenDepth(WMScreen *scr)
|
||||||
{
|
{
|
||||||
return scr->depth;
|
return scr->depth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned int
|
unsigned int
|
||||||
WMScreenWidth(WMScreen *scr)
|
WMScreenWidth(WMScreen *scr)
|
||||||
{
|
{
|
||||||
return scr->rootView->size.width;
|
return scr->rootView->size.width;
|
||||||
@@ -1205,7 +1209,7 @@ WMScreenHeight(WMScreen *scr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WMRedisplayWidget(WMWidget *w)
|
WMRedisplayWidget(WMWidget *w)
|
||||||
{
|
{
|
||||||
W_RedisplayView(W_VIEW(w));
|
W_RedisplayView(W_VIEW(w));
|
||||||
|
|||||||
1250
WINGs/wtext.c
1250
WINGs/wtext.c
File diff suppressed because it is too large
Load Diff
429
WINGs/wview.c
429
WINGs/wview.c
@@ -14,10 +14,10 @@ char *WMViewRealizedNotification = "WMViewRealizedNotification";
|
|||||||
|
|
||||||
|
|
||||||
#define EVENT_MASK \
|
#define EVENT_MASK \
|
||||||
KeyPressMask|KeyReleaseMask|ButtonPressMask|ButtonReleaseMask| \
|
KeyPressMask|KeyReleaseMask|ButtonPressMask|ButtonReleaseMask| \
|
||||||
EnterWindowMask|LeaveWindowMask|PointerMotionMask|ExposureMask| \
|
EnterWindowMask|LeaveWindowMask|PointerMotionMask|ExposureMask| \
|
||||||
VisibilityChangeMask|FocusChangeMask|PropertyChangeMask|\
|
VisibilityChangeMask|FocusChangeMask|PropertyChangeMask|\
|
||||||
SubstructureNotifyMask|SubstructureRedirectMask
|
SubstructureNotifyMask|SubstructureRedirectMask
|
||||||
|
|
||||||
|
|
||||||
static XSetWindowAttributes defAtts= {
|
static XSetWindowAttributes defAtts= {
|
||||||
@@ -26,21 +26,21 @@ static XSetWindowAttributes defAtts= {
|
|||||||
CopyFromParent, /* border_pixmap */
|
CopyFromParent, /* border_pixmap */
|
||||||
0, /* border_pixel */
|
0, /* border_pixel */
|
||||||
ForgetGravity, /* bit_gravity */
|
ForgetGravity, /* bit_gravity */
|
||||||
ForgetGravity, /* win_gravity */
|
ForgetGravity, /* win_gravity */
|
||||||
NotUseful, /* backing_store */
|
NotUseful, /* backing_store */
|
||||||
(unsigned) ~0, /* backing_planes */
|
(unsigned) ~0, /* backing_planes */
|
||||||
0, /* backing_pixel */
|
0, /* backing_pixel */
|
||||||
False, /* save_under */
|
False, /* save_under */
|
||||||
EVENT_MASK, /* event_mask */
|
EVENT_MASK, /* event_mask */
|
||||||
0, /* do_not_propagate_mask */
|
0, /* do_not_propagate_mask */
|
||||||
False, /* override_redirect */
|
False, /* override_redirect */
|
||||||
None, /* colormap */
|
None, /* colormap */
|
||||||
None /* cursor */
|
None /* cursor */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static XContext ViewContext=0; /* context for views */
|
static XContext ViewContext=0; /* context for views */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -49,9 +49,9 @@ W_View*
|
|||||||
W_GetViewForXWindow(Display *display, Window window)
|
W_GetViewForXWindow(Display *display, Window window)
|
||||||
{
|
{
|
||||||
W_View *view;
|
W_View *view;
|
||||||
|
|
||||||
if (XFindContext(display, window, ViewContext, (XPointer*)&view)==0) {
|
if (XFindContext(display, window, ViewContext, (XPointer*)&view)==0) {
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -63,20 +63,20 @@ unparentView(W_View *view)
|
|||||||
{
|
{
|
||||||
/* remove from parent's children list */
|
/* remove from parent's children list */
|
||||||
if (view->parent!=NULL) {
|
if (view->parent!=NULL) {
|
||||||
W_View *ptr;
|
W_View *ptr;
|
||||||
|
|
||||||
ptr = view->parent->childrenList;
|
ptr = view->parent->childrenList;
|
||||||
if (ptr == view) {
|
if (ptr == view) {
|
||||||
view->parent->childrenList = view->nextSister;
|
view->parent->childrenList = view->nextSister;
|
||||||
} else {
|
} else {
|
||||||
while (ptr!=NULL) {
|
while (ptr!=NULL) {
|
||||||
if (ptr->nextSister == view) {
|
if (ptr->nextSister == view) {
|
||||||
ptr->nextSister = view->nextSister;
|
ptr->nextSister = view->nextSister;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ptr = ptr->nextSister;
|
ptr = ptr->nextSister;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
view->parent = NULL;
|
view->parent = NULL;
|
||||||
}
|
}
|
||||||
@@ -89,14 +89,14 @@ adoptChildView(W_View *view, W_View *child)
|
|||||||
|
|
||||||
/* add to end of children list of parent */
|
/* add to end of children list of parent */
|
||||||
if (view->childrenList == NULL) {
|
if (view->childrenList == NULL) {
|
||||||
view->childrenList = child;
|
view->childrenList = child;
|
||||||
} else {
|
} else {
|
||||||
W_View *ptr;
|
W_View *ptr;
|
||||||
|
|
||||||
ptr = view->childrenList;
|
ptr = view->childrenList;
|
||||||
while (ptr->nextSister!=NULL)
|
while (ptr->nextSister!=NULL)
|
||||||
ptr = ptr->nextSister;
|
ptr = ptr->nextSister;
|
||||||
ptr->nextSister = child;
|
ptr->nextSister = child;
|
||||||
}
|
}
|
||||||
child->parent = view;
|
child->parent = view;
|
||||||
}
|
}
|
||||||
@@ -108,26 +108,26 @@ createView(W_Screen *screen, W_View *parent)
|
|||||||
W_View *view;
|
W_View *view;
|
||||||
|
|
||||||
if (ViewContext==0)
|
if (ViewContext==0)
|
||||||
ViewContext = XUniqueContext();
|
ViewContext = XUniqueContext();
|
||||||
|
|
||||||
view = wmalloc(sizeof(W_View));
|
view = wmalloc(sizeof(W_View));
|
||||||
memset(view, 0, sizeof(W_View));
|
memset(view, 0, sizeof(W_View));
|
||||||
|
|
||||||
view->screen = screen;
|
view->screen = screen;
|
||||||
|
|
||||||
if (parent!=NULL) {
|
if (parent!=NULL) {
|
||||||
/* attributes are not valid for root window */
|
/* attributes are not valid for root window */
|
||||||
view->attribFlags = CWEventMask|CWBitGravity;
|
view->attribFlags = CWEventMask|CWBitGravity;
|
||||||
view->attribs = defAtts;
|
view->attribs = defAtts;
|
||||||
|
|
||||||
view->attribFlags |= CWBackPixel|CWColormap|CWBorderPixel;
|
view->attribFlags |= CWBackPixel|CWColormap|CWBorderPixel;
|
||||||
view->attribs.background_pixel = W_PIXEL(screen->gray);
|
view->attribs.background_pixel = W_PIXEL(screen->gray);
|
||||||
view->attribs.border_pixel = W_PIXEL(screen->black);
|
view->attribs.border_pixel = W_PIXEL(screen->black);
|
||||||
view->attribs.colormap = screen->colormap;
|
view->attribs.colormap = screen->colormap;
|
||||||
|
|
||||||
view->backColor = WMRetainColor(screen->gray);
|
view->backColor = WMRetainColor(screen->gray);
|
||||||
|
|
||||||
adoptChildView(parent, view);
|
adoptChildView(parent, view);
|
||||||
}
|
}
|
||||||
|
|
||||||
view->refCount = 1;
|
view->refCount = 1;
|
||||||
@@ -150,19 +150,19 @@ W_View*
|
|||||||
W_CreateRootView(W_Screen *screen)
|
W_CreateRootView(W_Screen *screen)
|
||||||
{
|
{
|
||||||
W_View *view;
|
W_View *view;
|
||||||
|
|
||||||
view = createView(screen, NULL);
|
view = createView(screen, NULL);
|
||||||
|
|
||||||
view->window = screen->rootWin;
|
view->window = screen->rootWin;
|
||||||
|
|
||||||
view->flags.realized = 1;
|
view->flags.realized = 1;
|
||||||
view->flags.mapped = 1;
|
view->flags.mapped = 1;
|
||||||
view->flags.root = 1;
|
view->flags.root = 1;
|
||||||
|
|
||||||
view->size.width =
|
view->size.width =
|
||||||
WidthOfScreen(ScreenOfDisplay(screen->display, screen->screen));
|
WidthOfScreen(ScreenOfDisplay(screen->display, screen->screen));
|
||||||
view->size.height =
|
view->size.height =
|
||||||
HeightOfScreen(ScreenOfDisplay(screen->display, screen->screen));
|
HeightOfScreen(ScreenOfDisplay(screen->display, screen->screen));
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
@@ -172,10 +172,10 @@ W_View*
|
|||||||
W_CreateTopView(W_Screen *screen)
|
W_CreateTopView(W_Screen *screen)
|
||||||
{
|
{
|
||||||
W_View *view;
|
W_View *view;
|
||||||
|
|
||||||
view = createView(screen, screen->rootView);
|
view = createView(screen, screen->rootView);
|
||||||
if (!view)
|
if (!view)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
view->flags.topLevel = 1;
|
view->flags.topLevel = 1;
|
||||||
view->attribs.event_mask |= StructureNotifyMask;
|
view->attribs.event_mask |= StructureNotifyMask;
|
||||||
@@ -188,10 +188,10 @@ W_View*
|
|||||||
W_CreateUnmanagedTopView(W_Screen *screen)
|
W_CreateUnmanagedTopView(W_Screen *screen)
|
||||||
{
|
{
|
||||||
W_View *view;
|
W_View *view;
|
||||||
|
|
||||||
view = createView(screen, screen->rootView);
|
view = createView(screen, screen->rootView);
|
||||||
if (!view)
|
if (!view)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
view->flags.topLevel = 1;
|
view->flags.topLevel = 1;
|
||||||
view->attribs.event_mask |= StructureNotifyMask;
|
view->attribs.event_mask |= StructureNotifyMask;
|
||||||
@@ -215,36 +215,36 @@ W_RealizeView(W_View *view)
|
|||||||
|
|
||||||
|
|
||||||
if (view->parent && !view->parent->flags.realized) {
|
if (view->parent && !view->parent->flags.realized) {
|
||||||
wwarning("trying to realize widget of unrealized parent");
|
wwarning("trying to realize widget of unrealized parent");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!view->flags.realized) {
|
if (!view->flags.realized) {
|
||||||
parentWID = view->parent->window;
|
parentWID = view->parent->window;
|
||||||
view->window = XCreateWindow(dpy, parentWID, view->pos.x, view->pos.y,
|
view->window = XCreateWindow(dpy, parentWID, view->pos.x, view->pos.y,
|
||||||
view->size.width, view->size.height, 0,
|
view->size.width, view->size.height, 0,
|
||||||
view->screen->depth, InputOutput,
|
view->screen->depth, InputOutput,
|
||||||
view->screen->visual, view->attribFlags,
|
view->screen->visual, view->attribFlags,
|
||||||
&view->attribs);
|
&view->attribs);
|
||||||
|
|
||||||
XSaveContext(dpy, view->window, ViewContext, (XPointer)view);
|
XSaveContext(dpy, view->window, ViewContext, (XPointer)view);
|
||||||
|
|
||||||
view->flags.realized = 1;
|
view->flags.realized = 1;
|
||||||
|
|
||||||
if (view->flags.mapWhenRealized) {
|
if (view->flags.mapWhenRealized) {
|
||||||
W_MapView(view);
|
W_MapView(view);
|
||||||
view->flags.mapWhenRealized = 0;
|
view->flags.mapWhenRealized = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
WMPostNotificationName(WMViewRealizedNotification, view, NULL);
|
WMPostNotificationName(WMViewRealizedNotification, view, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* realize children */
|
/* realize children */
|
||||||
ptr = view->childrenList;
|
ptr = view->childrenList;
|
||||||
while (ptr!=NULL) {
|
while (ptr!=NULL) {
|
||||||
W_RealizeView(ptr);
|
W_RealizeView(ptr);
|
||||||
|
|
||||||
ptr = ptr->nextSister;
|
ptr = ptr->nextSister;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,14 +260,14 @@ W_ReparentView(W_View *view, W_View *newParent, int x, int y)
|
|||||||
adoptChildView(newParent, view);
|
adoptChildView(newParent, view);
|
||||||
|
|
||||||
if (view->flags.realized) {
|
if (view->flags.realized) {
|
||||||
if (newParent->flags.realized) {
|
if (newParent->flags.realized) {
|
||||||
XReparentWindow(dpy, view->window, newParent->window, x, y);
|
XReparentWindow(dpy, view->window, newParent->window, x, y);
|
||||||
} else {
|
} else {
|
||||||
wwarning("trying to reparent realized view to unrealized parent");
|
wwarning("trying to reparent realized view to unrealized parent");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
view->pos.x = x;
|
view->pos.x = x;
|
||||||
view->pos.y = y;
|
view->pos.y = y;
|
||||||
}
|
}
|
||||||
@@ -277,7 +277,7 @@ void
|
|||||||
W_RaiseView(W_View *view)
|
W_RaiseView(W_View *view)
|
||||||
{
|
{
|
||||||
if (W_VIEW_REALIZED(view))
|
if (W_VIEW_REALIZED(view))
|
||||||
XRaiseWindow(W_VIEW_DISPLAY(view), W_VIEW_DRAWABLE(view));
|
XRaiseWindow(W_VIEW_DISPLAY(view), W_VIEW_DRAWABLE(view));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -286,7 +286,7 @@ void
|
|||||||
W_LowerView(W_View *view)
|
W_LowerView(W_View *view)
|
||||||
{
|
{
|
||||||
if (W_VIEW_REALIZED(view))
|
if (W_VIEW_REALIZED(view))
|
||||||
XLowerWindow(W_VIEW_DISPLAY(view), W_VIEW_DRAWABLE(view));
|
XLowerWindow(W_VIEW_DISPLAY(view), W_VIEW_DRAWABLE(view));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -295,13 +295,13 @@ void
|
|||||||
W_MapView(W_View *view)
|
W_MapView(W_View *view)
|
||||||
{
|
{
|
||||||
if (!view->flags.mapped) {
|
if (!view->flags.mapped) {
|
||||||
if (view->flags.realized) {
|
if (view->flags.realized) {
|
||||||
XMapRaised(view->screen->display, view->window);
|
XMapRaised(view->screen->display, view->window);
|
||||||
XFlush(view->screen->display);
|
XFlush(view->screen->display);
|
||||||
view->flags.mapped = 1;
|
view->flags.mapped = 1;
|
||||||
} else {
|
} else {
|
||||||
view->flags.mapWhenRealized = 1;
|
view->flags.mapWhenRealized = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -315,12 +315,12 @@ W_MapSubviews(W_View *view)
|
|||||||
{
|
{
|
||||||
XMapSubwindows(view->screen->display, view->window);
|
XMapSubwindows(view->screen->display, view->window);
|
||||||
XFlush(view->screen->display);
|
XFlush(view->screen->display);
|
||||||
|
|
||||||
view = view->childrenList;
|
view = view->childrenList;
|
||||||
while (view) {
|
while (view) {
|
||||||
view->flags.mapped = 1;
|
view->flags.mapped = 1;
|
||||||
view->flags.mapWhenRealized = 0;
|
view->flags.mapWhenRealized = 0;
|
||||||
view = view->nextSister;
|
view = view->nextSister;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -331,12 +331,12 @@ W_UnmapSubviews(W_View *view)
|
|||||||
{
|
{
|
||||||
XUnmapSubwindows(view->screen->display, view->window);
|
XUnmapSubwindows(view->screen->display, view->window);
|
||||||
XFlush(view->screen->display);
|
XFlush(view->screen->display);
|
||||||
|
|
||||||
view = view->childrenList;
|
view = view->childrenList;
|
||||||
while (view) {
|
while (view) {
|
||||||
view->flags.mapped = 0;
|
view->flags.mapped = 0;
|
||||||
view->flags.mapWhenRealized = 0;
|
view->flags.mapWhenRealized = 0;
|
||||||
view = view->nextSister;
|
view = view->nextSister;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -347,7 +347,7 @@ W_UnmapView(W_View *view)
|
|||||||
{
|
{
|
||||||
view->flags.mapWhenRealized = 0;
|
view->flags.mapWhenRealized = 0;
|
||||||
if (!view->flags.mapped)
|
if (!view->flags.mapped)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
XUnmapWindow(view->screen->display, view->window);
|
XUnmapWindow(view->screen->display, view->window);
|
||||||
XFlush(view->screen->display);
|
XFlush(view->screen->display);
|
||||||
@@ -360,11 +360,11 @@ W_View*
|
|||||||
W_TopLevelOfView(W_View *view)
|
W_TopLevelOfView(W_View *view)
|
||||||
{
|
{
|
||||||
W_View *toplevel;
|
W_View *toplevel;
|
||||||
|
|
||||||
for (toplevel=view;
|
for (toplevel=view;
|
||||||
toplevel && !toplevel->flags.topLevel;
|
toplevel && !toplevel->flags.topLevel;
|
||||||
toplevel=toplevel->parent);
|
toplevel=toplevel->parent);
|
||||||
|
|
||||||
return toplevel;
|
return toplevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -375,8 +375,8 @@ destroyView(W_View *view)
|
|||||||
W_View *ptr;
|
W_View *ptr;
|
||||||
|
|
||||||
if (view->flags.alreadyDead)
|
if (view->flags.alreadyDead)
|
||||||
return;
|
return;
|
||||||
view->flags.alreadyDead = 1;
|
view->flags.alreadyDead = 1;
|
||||||
|
|
||||||
/* delete the balloon text for the view, if there's any */
|
/* delete the balloon text for the view, if there's any */
|
||||||
WMSetBalloonTextForView(NULL, view);
|
WMSetBalloonTextForView(NULL, view);
|
||||||
@@ -388,78 +388,67 @@ destroyView(W_View *view)
|
|||||||
|
|
||||||
/* Do not leave focus in a inexisting control */
|
/* Do not leave focus in a inexisting control */
|
||||||
if (W_FocusedViewOfToplevel(W_TopLevelOfView(view))==view)
|
if (W_FocusedViewOfToplevel(W_TopLevelOfView(view))==view)
|
||||||
W_SetFocusOfTopLevel(W_TopLevelOfView(view), NULL);
|
W_SetFocusOfTopLevel(W_TopLevelOfView(view), NULL);
|
||||||
|
|
||||||
if (view->flags.topLevel) {
|
if (view->flags.topLevel) {
|
||||||
W_FocusInfo *info = view->screen->focusInfo;
|
W_FocusInfo *info = view->screen->focusInfo;
|
||||||
/* remove focus information associated to this toplevel */
|
/* remove focus information associated to this toplevel */
|
||||||
|
|
||||||
if (info) {
|
if (info) {
|
||||||
if (info->toplevel==view) {
|
if (info->toplevel==view) {
|
||||||
view->screen->focusInfo = info->next;
|
view->screen->focusInfo = info->next;
|
||||||
wfree(info);
|
wfree(info);
|
||||||
} else {
|
} else {
|
||||||
while (info->next) {
|
while (info->next) {
|
||||||
if (info->next->toplevel == view)
|
if (info->next->toplevel == view)
|
||||||
break;
|
break;
|
||||||
info = info->next;
|
info = info->next;
|
||||||
}
|
}
|
||||||
if (info->next) {
|
if (info->next) {
|
||||||
W_FocusInfo *next = info->next->next;
|
W_FocusInfo *next = info->next->next;
|
||||||
wfree(info->next);
|
wfree(info->next);
|
||||||
info->next = next;
|
info->next = next;
|
||||||
}
|
}
|
||||||
/* else the toplevel did not have any focused subview */
|
/* else the toplevel did not have any focused subview */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* destroy children recursively */
|
/* destroy children recursively */
|
||||||
while (view->childrenList!=NULL) {
|
while (view->childrenList!=NULL) {
|
||||||
ptr = view->childrenList;
|
ptr = view->childrenList;
|
||||||
ptr->flags.parentDying = 1;
|
ptr->flags.parentDying = 1;
|
||||||
|
|
||||||
W_DestroyView(ptr);
|
W_DestroyView(ptr);
|
||||||
|
|
||||||
if (ptr == view->childrenList) {
|
if (ptr == view->childrenList) {
|
||||||
view->childrenList = ptr->nextSister;
|
view->childrenList = ptr->nextSister;
|
||||||
ptr->parent = NULL;
|
ptr->parent = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
W_CallDestroyHandlers(view);
|
W_CallDestroyHandlers(view);
|
||||||
|
|
||||||
if (view->flags.realized) {
|
if (view->flags.realized) {
|
||||||
XDeleteContext(view->screen->display,
|
XDeleteContext(view->screen->display,
|
||||||
view->window, ViewContext);
|
view->window, ViewContext);
|
||||||
|
|
||||||
/* if parent is being destroyed, it will die naturaly */
|
/* if parent is being destroyed, it will die naturaly */
|
||||||
if (!view->flags.parentDying || view->flags.topLevel)
|
if (!view->flags.parentDying || view->flags.topLevel)
|
||||||
XDestroyWindow(view->screen->display, view->window);
|
XDestroyWindow(view->screen->display, view->window);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* remove self from parent's children list */
|
/* remove self from parent's children list */
|
||||||
unparentView(view);
|
unparentView(view);
|
||||||
|
|
||||||
/* the array has a wfree() destructor that will be called automatically */
|
/* the array has a wfree() destructor that will be called automatically */
|
||||||
WMFreeArray(view->eventHandlers);
|
WMFreeArray(view->eventHandlers);
|
||||||
view->eventHandlers = NULL;
|
view->eventHandlers = NULL;
|
||||||
|
|
||||||
WMUnregisterViewDraggedTypes(view);
|
|
||||||
|
|
||||||
WMRemoveNotificationObserver(view);
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (view->dragSourceProcs)
|
|
||||||
wfree(view->dragSourceProcs);
|
|
||||||
|
|
||||||
if (view->dragDestinationProcs)
|
WMRemoveNotificationObserver(view);
|
||||||
wfree(view->dragDestinationProcs);
|
|
||||||
|
W_FreeViewXdndPart(view);
|
||||||
if (scr->dragInfo.destView == view) {
|
|
||||||
scr->dragInfo.destView = NULL;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
wfree(view);
|
wfree(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -483,20 +472,20 @@ W_MoveView(W_View *view, int x, int y)
|
|||||||
assert(view->flags.root==0);
|
assert(view->flags.root==0);
|
||||||
|
|
||||||
if (view->delegate && view->delegate->willMove) {
|
if (view->delegate && view->delegate->willMove) {
|
||||||
(*view->delegate->willMove)(view->delegate, view, &x, &y);
|
(*view->delegate->willMove)(view->delegate, view, &x, &y);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (view->pos.x == x && view->pos.y == y)
|
if (view->pos.x == x && view->pos.y == y)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (view->flags.realized) {
|
if (view->flags.realized) {
|
||||||
XMoveWindow(view->screen->display, view->window, x, y);
|
XMoveWindow(view->screen->display, view->window, x, y);
|
||||||
}
|
}
|
||||||
view->pos.x = x;
|
view->pos.x = x;
|
||||||
view->pos.y = y;
|
view->pos.y = y;
|
||||||
|
|
||||||
if (view->delegate && view->delegate->didMove) {
|
if (view->delegate && view->delegate->didMove) {
|
||||||
(*view->delegate->didMove)(view->delegate, view);
|
(*view->delegate->didMove)(view->delegate, view);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -507,30 +496,30 @@ W_ResizeView(W_View *view, unsigned int width, unsigned int height)
|
|||||||
/*int shrinked;*/
|
/*int shrinked;*/
|
||||||
|
|
||||||
if (view->delegate && view->delegate->willResize) {
|
if (view->delegate && view->delegate->willResize) {
|
||||||
(*view->delegate->willResize)(view->delegate, view, &width, &height);
|
(*view->delegate->willResize)(view->delegate, view, &width, &height);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(width > 0);
|
assert(width > 0);
|
||||||
assert(height > 0);
|
assert(height > 0);
|
||||||
|
|
||||||
if (view->size.width == width && view->size.height == height)
|
if (view->size.width == width && view->size.height == height)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/*shrinked = width < view->size.width || height < view->size.height;*/
|
/*shrinked = width < view->size.width || height < view->size.height;*/
|
||||||
|
|
||||||
if (view->flags.realized) {
|
if (view->flags.realized) {
|
||||||
XResizeWindow(view->screen->display, view->window, width, height);
|
XResizeWindow(view->screen->display, view->window, width, height);
|
||||||
}
|
}
|
||||||
view->size.width = width;
|
view->size.width = width;
|
||||||
view->size.height = height;
|
view->size.height = height;
|
||||||
|
|
||||||
if (view->delegate && view->delegate->didResize) {
|
if (view->delegate && view->delegate->didResize) {
|
||||||
(*view->delegate->didResize)(view->delegate, view);
|
(*view->delegate->didResize)(view->delegate, view);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* // TODO. replace in WINGs code, with the didResize delegate */
|
/* // TODO. replace in WINGs code, with the didResize delegate */
|
||||||
if (view->flags.notifySizeChanged)
|
if (view->flags.notifySizeChanged)
|
||||||
WMPostNotificationName(WMViewSizeDidChangeNotification, view, NULL);
|
WMPostNotificationName(WMViewSizeDidChangeNotification, view, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -538,10 +527,10 @@ void
|
|||||||
W_RedisplayView(W_View *view)
|
W_RedisplayView(W_View *view)
|
||||||
{
|
{
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
|
|
||||||
if (!view->flags.mapped)
|
if (!view->flags.mapped)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ev.xexpose.type = Expose;
|
ev.xexpose.type = Expose;
|
||||||
ev.xexpose.display = view->screen->display;
|
ev.xexpose.display = view->screen->display;
|
||||||
ev.xexpose.window = view->window;
|
ev.xexpose.window = view->window;
|
||||||
@@ -557,28 +546,28 @@ void
|
|||||||
W_SetViewBackgroundColor(W_View *view, WMColor *color)
|
W_SetViewBackgroundColor(W_View *view, WMColor *color)
|
||||||
{
|
{
|
||||||
if (view->backColor)
|
if (view->backColor)
|
||||||
WMReleaseColor(view->backColor);
|
WMReleaseColor(view->backColor);
|
||||||
view->backColor = WMRetainColor(color);
|
view->backColor = WMRetainColor(color);
|
||||||
|
|
||||||
view->attribFlags |= CWBackPixel;
|
view->attribFlags |= CWBackPixel;
|
||||||
view->attribs.background_pixel = W_PIXEL(color);
|
view->attribs.background_pixel = W_PIXEL(color);
|
||||||
if (view->flags.realized) {
|
if (view->flags.realized) {
|
||||||
XSetWindowBackground(view->screen->display, view->window,
|
XSetWindowBackground(view->screen->display, view->window,
|
||||||
W_PIXEL(color));
|
W_PIXEL(color));
|
||||||
XClearWindow(view->screen->display, view->window);
|
XClearWindow(view->screen->display, view->window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
W_SetViewCursor(W_View *view, Cursor cursor)
|
W_SetViewCursor(W_View *view, Cursor cursor)
|
||||||
{
|
{
|
||||||
view->cursor = cursor;
|
view->cursor = cursor;
|
||||||
if (W_VIEW_REALIZED(view)) {
|
if (W_VIEW_REALIZED(view)) {
|
||||||
XDefineCursor(W_VIEW_DISPLAY(view), W_VIEW_DRAWABLE(view), cursor);
|
XDefineCursor(W_VIEW_DISPLAY(view), W_VIEW_DRAWABLE(view), cursor);
|
||||||
} else {
|
} else {
|
||||||
view->attribFlags |= CWCursor;
|
view->attribFlags |= CWCursor;
|
||||||
view->attribs.cursor = cursor;
|
view->attribs.cursor = cursor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -588,14 +577,14 @@ W_FocusedViewOfToplevel(W_View *view)
|
|||||||
{
|
{
|
||||||
WMScreen *scr = view->screen;
|
WMScreen *scr = view->screen;
|
||||||
W_FocusInfo *info;
|
W_FocusInfo *info;
|
||||||
|
|
||||||
for (info = scr->focusInfo; info!=NULL; info = info->next)
|
for (info = scr->focusInfo; info!=NULL; info = info->next)
|
||||||
if (view == info->toplevel)
|
if (view == info->toplevel)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (!info)
|
if (!info)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return info->focused;
|
return info->focused;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -606,61 +595,61 @@ W_SetFocusOfTopLevel(W_View *toplevel, W_View *view)
|
|||||||
WMScreen *scr = toplevel->screen;
|
WMScreen *scr = toplevel->screen;
|
||||||
XEvent event;
|
XEvent event;
|
||||||
W_FocusInfo *info;
|
W_FocusInfo *info;
|
||||||
|
|
||||||
for (info = scr->focusInfo; info!=NULL; info = info->next)
|
for (info = scr->focusInfo; info!=NULL; info = info->next)
|
||||||
if (toplevel == info->toplevel)
|
if (toplevel == info->toplevel)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (!info) {
|
if (!info) {
|
||||||
info = wmalloc(sizeof(W_FocusInfo));
|
info = wmalloc(sizeof(W_FocusInfo));
|
||||||
info->toplevel = toplevel;
|
info->toplevel = toplevel;
|
||||||
info->focused = view;
|
info->focused = view;
|
||||||
info->next = scr->focusInfo;
|
info->next = scr->focusInfo;
|
||||||
scr->focusInfo = info;
|
scr->focusInfo = info;
|
||||||
} else {
|
} else {
|
||||||
event.xfocus.mode = NotifyNormal;
|
event.xfocus.mode = NotifyNormal;
|
||||||
event.xfocus.detail = NotifyDetailNone;
|
event.xfocus.detail = NotifyDetailNone;
|
||||||
if (info->focused) {
|
if (info->focused) {
|
||||||
/* simulate FocusOut event */
|
/* simulate FocusOut event */
|
||||||
event.xfocus.type = FocusOut;
|
event.xfocus.type = FocusOut;
|
||||||
W_DispatchMessage(info->focused, &event);
|
W_DispatchMessage(info->focused, &event);
|
||||||
}
|
}
|
||||||
info->focused = view;
|
info->focused = view;
|
||||||
}
|
}
|
||||||
if (view) {
|
if (view) {
|
||||||
/* simulate FocusIn event */
|
/* simulate FocusIn event */
|
||||||
event.xfocus.type = FocusIn;
|
event.xfocus.type = FocusIn;
|
||||||
W_DispatchMessage(view, &event);
|
W_DispatchMessage(view, &event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
W_BroadcastMessage(W_View *targetParent, XEvent *event)
|
W_BroadcastMessage(W_View *targetParent, XEvent *event)
|
||||||
{
|
{
|
||||||
W_View *target;
|
W_View *target;
|
||||||
|
|
||||||
target = targetParent->childrenList;
|
target = targetParent->childrenList;
|
||||||
while (target!=NULL) {
|
while (target!=NULL) {
|
||||||
W_DispatchMessage(target, event);
|
W_DispatchMessage(target, event);
|
||||||
|
|
||||||
target = target->nextSister;
|
target = target->nextSister;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
W_DispatchMessage(W_View *target, XEvent *event)
|
W_DispatchMessage(W_View *target, XEvent *event)
|
||||||
{
|
{
|
||||||
if (target->window==None)
|
if (target->window==None)
|
||||||
return;
|
return;
|
||||||
event->xclient.window = target->window;
|
event->xclient.window = target->window;
|
||||||
event->xclient.display = target->screen->display;
|
event->xclient.display = target->screen->display;
|
||||||
|
|
||||||
WMHandleEvent(event);
|
WMHandleEvent(event);
|
||||||
/*
|
/*
|
||||||
XSendEvent(target->screen->display, target->window, False,
|
XSendEvent(target->screen->display, target->window, False,
|
||||||
SubstructureNotifyMask, event);
|
SubstructureNotifyMask, event);
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -681,7 +670,7 @@ W_ReleaseView(WMView *view)
|
|||||||
view->refCount--;
|
view->refCount--;
|
||||||
|
|
||||||
if (view->refCount < 1) {
|
if (view->refCount < 1) {
|
||||||
destroyView(view);
|
destroyView(view);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -693,13 +682,13 @@ WMWidgetOfView(WMView *view)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WMSize
|
WMSize
|
||||||
WMGetViewSize(WMView *view)
|
WMGetViewSize(WMView *view)
|
||||||
{
|
{
|
||||||
return view->size;
|
return view->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
WMPoint
|
WMPoint
|
||||||
WMGetViewPosition(WMView *view)
|
WMGetViewPosition(WMView *view)
|
||||||
{
|
{
|
||||||
return view->pos;
|
return view->pos;
|
||||||
@@ -738,7 +727,7 @@ WMGetViewScreenPosition(WMView *view)
|
|||||||
}
|
}
|
||||||
|
|
||||||
XTranslateCoordinates(scr->display, W_VIEW_DRAWABLE(view),
|
XTranslateCoordinates(scr->display, W_VIEW_DRAWABLE(view),
|
||||||
scr->rootWin, 0, 0, &x, &y, &foo);
|
scr->rootWin, 0, 0, &x, &y, &foo);
|
||||||
|
|
||||||
return wmkpoint(x-topX, y-topY);
|
return wmkpoint(x-topX, y-topY);
|
||||||
}
|
}
|
||||||
@@ -752,13 +741,13 @@ resizedParent(void *self, WMNotification *notif)
|
|||||||
|
|
||||||
W_MoveView(view, view->leftOffs, view->topOffs);
|
W_MoveView(view, view->leftOffs, view->topOffs);
|
||||||
W_ResizeView(view, size.width - (view->leftOffs + view->rightOffs),
|
W_ResizeView(view, size.width - (view->leftOffs + view->rightOffs),
|
||||||
size.height - (view->topOffs + view->bottomOffs));
|
size.height - (view->topOffs + view->bottomOffs));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WMSetViewExpandsToParent(WMView *view, int leftOffs, int topOffs,
|
WMSetViewExpandsToParent(WMView *view, int leftOffs, int topOffs,
|
||||||
int rightOffs, int bottomOffs)
|
int rightOffs, int bottomOffs)
|
||||||
{
|
{
|
||||||
WMSize size = view->parent->size;
|
WMSize size = view->parent->size;
|
||||||
|
|
||||||
@@ -766,15 +755,15 @@ WMSetViewExpandsToParent(WMView *view, int leftOffs, int topOffs,
|
|||||||
view->bottomOffs = bottomOffs;
|
view->bottomOffs = bottomOffs;
|
||||||
view->leftOffs = leftOffs;
|
view->leftOffs = leftOffs;
|
||||||
view->rightOffs = rightOffs;
|
view->rightOffs = rightOffs;
|
||||||
|
|
||||||
WMAddNotificationObserver(resizedParent, view,
|
WMAddNotificationObserver(resizedParent, view,
|
||||||
WMViewSizeDidChangeNotification,
|
WMViewSizeDidChangeNotification,
|
||||||
view->parent);
|
view->parent);
|
||||||
WMSetViewNotifySizeChanges(view->parent, True);
|
WMSetViewNotifySizeChanges(view->parent, True);
|
||||||
|
|
||||||
W_MoveView(view, leftOffs, topOffs);
|
W_MoveView(view, leftOffs, topOffs);
|
||||||
W_ResizeView(view, size.width - (leftOffs + rightOffs),
|
W_ResizeView(view, size.width - (leftOffs + rightOffs),
|
||||||
size.height - (topOffs + bottomOffs));
|
size.height - (topOffs + bottomOffs));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ showData(_Panel *panel)
|
|||||||
WMSetButtonSelected(panel->swi[4], GetBoolForKey("WindozeCycling"));
|
WMSetButtonSelected(panel->swi[4], GetBoolForKey("WindozeCycling"));
|
||||||
WMSetButtonSelected(panel->swi[5], GetBoolForKey("DontConfirmKill"));
|
WMSetButtonSelected(panel->swi[5], GetBoolForKey("DontConfirmKill"));
|
||||||
WMSetButtonSelected(panel->swi[6], GetBoolForKey("DisableBlinking"));
|
WMSetButtonSelected(panel->swi[6], GetBoolForKey("DisableBlinking"));
|
||||||
if (WMHasAntialiasingSupport(WMWidgetScreen(panel->box)))
|
//if (WMHasAntialiasingSupport(WMWidgetScreen(panel->box)))
|
||||||
WMSetButtonSelected(panel->swi[7], GetBoolForKey("AntialiasedText"));
|
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[6], _("Disable selection animation for selected icons."));
|
||||||
WMSetButtonText(panel->swi[7], _("Smooth font edges (needs restart)."));
|
WMSetButtonText(panel->swi[7], _("Smooth font edges (needs restart)."));
|
||||||
|
|
||||||
if (!WMHasAntialiasingSupport(WMWidgetScreen(panel->box)))
|
//if (!WMHasAntialiasingSupport(WMWidgetScreen(panel->box)))
|
||||||
WMSetButtonEnabled(panel->swi[7], False);
|
WMSetButtonEnabled(panel->swi[7], False);
|
||||||
|
|
||||||
WMRealizeWidget(panel->box);
|
WMRealizeWidget(panel->box);
|
||||||
@@ -107,7 +107,7 @@ storeDefaults(_Panel *panel)
|
|||||||
SetBoolForKey(WMGetButtonSelected(panel->swi[4]), "WindozeCycling");
|
SetBoolForKey(WMGetButtonSelected(panel->swi[4]), "WindozeCycling");
|
||||||
SetBoolForKey(WMGetButtonSelected(panel->swi[5]), "DontConfirmKill");
|
SetBoolForKey(WMGetButtonSelected(panel->swi[5]), "DontConfirmKill");
|
||||||
SetBoolForKey(WMGetButtonSelected(panel->swi[6]), "DisableBlinking");
|
SetBoolForKey(WMGetButtonSelected(panel->swi[6]), "DisableBlinking");
|
||||||
if (WMHasAntialiasingSupport(WMWidgetScreen(panel->box)))
|
//if (WMHasAntialiasingSupport(WMWidgetScreen(panel->box)))
|
||||||
SetBoolForKey(WMGetButtonSelected(panel->swi[7]), "AntialiasedText");
|
SetBoolForKey(WMGetButtonSelected(panel->swi[7]), "AntialiasedText");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
/* Font.c- text/font settings
|
/* Font.c- text/font settings
|
||||||
*
|
*
|
||||||
* WPrefs - Window Maker Preferences Program
|
* WPrefs - Window Maker Preferences Program
|
||||||
*
|
*
|
||||||
* Copyright (c) 1999-2003 Alfredo K. Kojima
|
* Copyright (c) 1999-2003 Alfredo K. Kojima
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
* USA.
|
* USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -27,12 +27,12 @@
|
|||||||
|
|
||||||
typedef struct _Panel {
|
typedef struct _Panel {
|
||||||
WMBox *box;
|
WMBox *box;
|
||||||
char *sectionName;
|
char *sectionName;
|
||||||
|
|
||||||
char *description;
|
char *description;
|
||||||
|
|
||||||
CallbackRec callbacks;
|
CallbackRec callbacks;
|
||||||
|
|
||||||
WMWidget *parent;
|
WMWidget *parent;
|
||||||
|
|
||||||
|
|
||||||
@@ -47,15 +47,15 @@ typedef struct _Panel {
|
|||||||
WMPopUpButton *langP;
|
WMPopUpButton *langP;
|
||||||
WMFrame *aaF;
|
WMFrame *aaF;
|
||||||
WMButton *togAA;
|
WMButton *togAA;
|
||||||
|
|
||||||
/* single byte */
|
/* single byte */
|
||||||
WMTextField *fontT;
|
WMTextField *fontT;
|
||||||
WMButton *changeB;
|
WMButton *changeB;
|
||||||
|
|
||||||
/* multibyte */
|
/* multibyte */
|
||||||
WMLabel *fsetL;
|
WMLabel *fsetL;
|
||||||
WMList *fsetLs;
|
WMList *fsetLs;
|
||||||
|
|
||||||
WMButton *addB;
|
WMButton *addB;
|
||||||
WMButton *editB;
|
WMButton *editB;
|
||||||
WMButton *remB;
|
WMButton *remB;
|
||||||
@@ -67,7 +67,7 @@ typedef struct _Panel {
|
|||||||
WMColor *black;
|
WMColor *black;
|
||||||
WMColor *light;
|
WMColor *light;
|
||||||
WMColor *dark;
|
WMColor *dark;
|
||||||
|
|
||||||
WMColor *back;
|
WMColor *back;
|
||||||
WMColor *colors[9];
|
WMColor *colors[9];
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ typedef struct _Panel {
|
|||||||
WMPixmap *down_arrow;
|
WMPixmap *down_arrow;
|
||||||
WMPixmap *alt_up_arrow;
|
WMPixmap *alt_up_arrow;
|
||||||
WMPixmap *alt_down_arrow;
|
WMPixmap *alt_down_arrow;
|
||||||
|
|
||||||
int oldsection;
|
int oldsection;
|
||||||
char menuStyle;
|
char menuStyle;
|
||||||
char titleAlignment;
|
char titleAlignment;
|
||||||
@@ -104,7 +104,7 @@ static WMRect previewPositions[] = {
|
|||||||
{{156, 35},{64, 64}},
|
{{156, 35},{64, 64}},
|
||||||
#define PICON 5
|
#define PICON 5
|
||||||
{{156, 105},{64, 64}}
|
{{156, 105},{64, 64}}
|
||||||
};
|
};
|
||||||
#define EVERYTHING 0xff
|
#define EVERYTHING 0xff
|
||||||
|
|
||||||
static char *colorOptions[] = {
|
static char *colorOptions[] = {
|
||||||
@@ -277,7 +277,7 @@ static char* getFontEncoding(void *data);
|
|||||||
static char* getFontSampleString(void *data);
|
static char* getFontSampleString(void *data);
|
||||||
|
|
||||||
/* note single element */
|
/* note single element */
|
||||||
static WMFont* getFontForPreview(void *data, int element);
|
static WMFont* getFontForPreview(void *data, int element);
|
||||||
static WMFont* getDefaultSystemFont(void *data, int element);
|
static WMFont* getDefaultSystemFont(void *data, int element);
|
||||||
|
|
||||||
static WMPropList* getDefaultFontProp(void *data, char *encoding, int section);
|
static WMPropList* getDefaultFontProp(void *data, char *encoding, int section);
|
||||||
@@ -289,7 +289,7 @@ static void
|
|||||||
str2rcolor(RContext *rc, char *name, RColor *color)
|
str2rcolor(RContext *rc, char *name, RColor *color)
|
||||||
{
|
{
|
||||||
XColor xcolor;
|
XColor xcolor;
|
||||||
|
|
||||||
XParseColor(rc->dpy, rc->cmap, name, &xcolor);
|
XParseColor(rc->dpy, rc->cmap, name, &xcolor);
|
||||||
|
|
||||||
color->alpha = 255;
|
color->alpha = 255;
|
||||||
@@ -304,22 +304,22 @@ drawMenuBevel(RImage *img)
|
|||||||
RColor light, dark, mid;
|
RColor light, dark, mid;
|
||||||
int i;
|
int i;
|
||||||
int iheight = img->height / 4;
|
int iheight = img->height / 4;
|
||||||
|
|
||||||
light.alpha = 0;
|
light.alpha = 0;
|
||||||
light.red = light.green = light.blue = 80;
|
light.red = light.green = light.blue = 80;
|
||||||
|
|
||||||
dark.alpha = 255;
|
dark.alpha = 255;
|
||||||
dark.red = dark.green = dark.blue = 0;
|
dark.red = dark.green = dark.blue = 0;
|
||||||
|
|
||||||
mid.alpha = 0;
|
mid.alpha = 0;
|
||||||
mid.red = mid.green = mid.blue = 40;
|
mid.red = mid.green = mid.blue = 40;
|
||||||
|
|
||||||
for (i = 1; i < 4; i++) {
|
for (i = 1; i < 4; i++) {
|
||||||
ROperateLine(img, RSubtractOperation, 0, i*iheight-2,
|
ROperateLine(img, RSubtractOperation, 0, i*iheight-2,
|
||||||
img->width-1, i*iheight-2, &mid);
|
img->width-1, i*iheight-2, &mid);
|
||||||
|
|
||||||
RDrawLine(img, 0, i*iheight-1, img->width-1, i*iheight-1, &dark);
|
RDrawLine(img, 0, i*iheight-1, img->width-1, i*iheight-1, &dark);
|
||||||
|
|
||||||
ROperateLine(img, RAddOperation, 1, i*iheight,
|
ROperateLine(img, RAddOperation, 1, i*iheight,
|
||||||
img->width-2, i*iheight, &light);
|
img->width-2, i*iheight, &light);
|
||||||
}
|
}
|
||||||
@@ -368,7 +368,7 @@ paintItems(WMScreen *scr, Drawable d, WMColor *color, WMFont *font,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
paintIcon(WMScreen *scr,Drawable d, WMColor *color, WMColor *Iback,
|
paintIcon(WMScreen *scr,Drawable d, WMColor *color, WMColor *Iback,
|
||||||
WMFont *font, int part, char *text)
|
WMFont *font, int part, char *text)
|
||||||
{
|
{
|
||||||
Display *dpy = WMScreenDisplay(scr);
|
Display *dpy = WMScreenDisplay(scr);
|
||||||
@@ -377,14 +377,14 @@ paintIcon(WMScreen *scr,Drawable d, WMColor *color, WMColor *Iback,
|
|||||||
int y = previewPositions[part].pos.y+1;
|
int y = previewPositions[part].pos.y+1;
|
||||||
int w = previewPositions[part].size.width-2;
|
int w = previewPositions[part].size.width-2;
|
||||||
int h = WMFontHeight(font)+2;
|
int h = WMFontHeight(font)+2;
|
||||||
|
|
||||||
XFillRectangle(dpy, d, WMColorGC(Iback), x, y, w, h);
|
XFillRectangle(dpy, d, WMColorGC(Iback), x, y, w, h);
|
||||||
x += (w - WMWidthOfString(font, text, l))/2;
|
x += (w - WMWidthOfString(font, text, l))/2;
|
||||||
WMDrawString(scr, d, color, font, x,
|
WMDrawString(scr, d, color, font, x,
|
||||||
y + (h - WMFontHeight(font))/2, text, l);
|
y + (h - WMFontHeight(font))/2, text, l);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
drawFonts(_Panel *panel, int elements)
|
drawFonts(_Panel *panel, int elements)
|
||||||
{
|
{
|
||||||
@@ -400,7 +400,7 @@ drawFonts(_Panel *panel, int elements)
|
|||||||
WINTITLE, panel->titleAlignment, _("Window Title Font"));
|
WINTITLE, panel->titleAlignment, _("Window Title Font"));
|
||||||
}
|
}
|
||||||
if(elements & DISCOL) {
|
if(elements & DISCOL) {
|
||||||
paintTitle(scr, d, panel->white, getFontForPreview(panel, DISTITLE),
|
paintTitle(scr, d, panel->white, getFontForPreview(panel, DISTITLE),
|
||||||
DISTITLE, WACenter, _("Display"));
|
DISTITLE, WACenter, _("Display"));
|
||||||
}
|
}
|
||||||
if(elements & MTITLE) {
|
if(elements & MTITLE) {
|
||||||
@@ -412,13 +412,13 @@ drawFonts(_Panel *panel, int elements)
|
|||||||
PMITEM, _("Menu Item"));
|
PMITEM, _("Menu Item"));
|
||||||
}
|
}
|
||||||
if(elements & CLIP) {
|
if(elements & CLIP) {
|
||||||
WMDrawString(scr, d, panel->colors[4],
|
WMDrawString(scr, d, panel->colors[4],
|
||||||
getFontForPreview(panel, PCLIP), 169,37, "1",1);
|
getFontForPreview(panel, PCLIP), 169,37, "1",1);
|
||||||
WMDrawString(scr, d, panel->colors[3],
|
WMDrawString(scr, d, panel->colors[3],
|
||||||
getFontForPreview(panel, PCLIP),179, 84, _("Clip title"), 10);
|
getFontForPreview(panel, PCLIP),179, 84, _("Clip title"), 10);
|
||||||
}
|
}
|
||||||
if(elements & ICONT) {
|
if(elements & ICONT) {
|
||||||
paintIcon(scr, d, panel->colors[5], panel->colors[6],
|
paintIcon(scr, d, panel->colors[5], panel->colors[6],
|
||||||
getFontForPreview(panel, PICON), PICON, _("Icon Title"));
|
getFontForPreview(panel, PICON), PICON, _("Icon Title"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -554,14 +554,14 @@ renderTexture(WMScreen *scr, WMPropList *texture, int width, int height,
|
|||||||
if (!path || !timage) {
|
if (!path || !timage) {
|
||||||
wwarning("could not load file '%s': %s", path,
|
wwarning("could not load file '%s': %s", path,
|
||||||
RMessageForError(RErrorCode));
|
RMessageForError(RErrorCode));
|
||||||
} else {
|
} else {
|
||||||
grad = RRenderGradient(width, height, &rcolor, &rcolor2, style);
|
grad = RRenderGradient(width, height, &rcolor, &rcolor2, style);
|
||||||
|
|
||||||
image = RMakeTiledImage(timage, width, height);
|
image = RMakeTiledImage(timage, width, height);
|
||||||
RReleaseImage(timage);
|
RReleaseImage(timage);
|
||||||
|
|
||||||
i = atoi(WMGetFromPLString(WMGetFromPLArray(texture, 2)));
|
i = atoi(WMGetFromPLString(WMGetFromPLArray(texture, 2)));
|
||||||
|
|
||||||
RCombineImagesWithOpaqueness(image, grad, i);
|
RCombineImagesWithOpaqueness(image, grad, i);
|
||||||
RReleaseImage(grad);
|
RReleaseImage(grad);
|
||||||
}
|
}
|
||||||
@@ -584,7 +584,7 @@ renderTexture(WMScreen *scr, WMPropList *texture, int width, int height,
|
|||||||
}
|
}
|
||||||
|
|
||||||
j = WMGetPropListItemCount(texture);
|
j = WMGetPropListItemCount(texture);
|
||||||
|
|
||||||
if (j > 0) {
|
if (j > 0) {
|
||||||
colors = wmalloc(j * sizeof(RColor*));
|
colors = wmalloc(j * sizeof(RColor*));
|
||||||
|
|
||||||
@@ -596,7 +596,7 @@ renderTexture(WMScreen *scr, WMPropList *texture, int width, int height,
|
|||||||
colors[i-2] = NULL;
|
colors[i-2] = NULL;
|
||||||
|
|
||||||
image = RRenderMultiGradient(width, height, colors, style);
|
image = RRenderMultiGradient(width, height, colors, style);
|
||||||
|
|
||||||
for (i = 0; colors[i]!=NULL; i++)
|
for (i = 0; colors[i]!=NULL; i++)
|
||||||
wfree(colors[i]);
|
wfree(colors[i]);
|
||||||
wfree(colors);
|
wfree(colors);
|
||||||
@@ -647,7 +647,7 @@ renderTexture(WMScreen *scr, WMPropList *texture, int width, int height,
|
|||||||
if (path) {
|
if (path) {
|
||||||
dumpRImage(path, image);
|
dumpRImage(path, image);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (border < 0) {
|
if (border < 0) {
|
||||||
if (border == MENU_BEVEL) {
|
if (border == MENU_BEVEL) {
|
||||||
drawMenuBevel(image);
|
drawMenuBevel(image);
|
||||||
@@ -695,7 +695,7 @@ renderMenu(_Panel *panel, WMPropList *texture, int width, int iheight)
|
|||||||
return pix;
|
return pix;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
renderClip(_Panel *panel, GC gc, int part, int relief)
|
renderClip(_Panel *panel, GC gc, int part, int relief)
|
||||||
{
|
{
|
||||||
WMScreen *scr = WMWidgetScreen(panel->box);
|
WMScreen *scr = WMWidgetScreen(panel->box);
|
||||||
@@ -703,7 +703,7 @@ renderClip(_Panel *panel, GC gc, int part, int relief)
|
|||||||
RContext *rc = WMScreenRContext(scr);
|
RContext *rc = WMScreenRContext(scr);
|
||||||
WMPropList *prop;
|
WMPropList *prop;
|
||||||
Pixmap pix;
|
Pixmap pix;
|
||||||
XImage *original;
|
XImage *original;
|
||||||
XPoint p[4];
|
XPoint p[4];
|
||||||
RImage *tile;
|
RImage *tile;
|
||||||
RColor black;
|
RColor black;
|
||||||
@@ -714,22 +714,22 @@ renderClip(_Panel *panel, GC gc, int part, int relief)
|
|||||||
|
|
||||||
prop = GetObjectForKey(textureOptions[part]);
|
prop = GetObjectForKey(textureOptions[part]);
|
||||||
|
|
||||||
pix = renderTexture(scr, prop,
|
pix = renderTexture(scr, prop,
|
||||||
previewPositions[part].size.width,
|
previewPositions[part].size.width,
|
||||||
previewPositions[part].size.height,
|
previewPositions[part].size.height,
|
||||||
NULL, relief);
|
NULL, relief);
|
||||||
|
|
||||||
|
|
||||||
original = XGetImage(dpy, pix, 0, 0, 64, 64,
|
original = XGetImage(dpy, pix, 0, 0, 64, 64,
|
||||||
AllPlanes, ZPixmap);
|
AllPlanes, ZPixmap);
|
||||||
if (!original){
|
if (!original){
|
||||||
wwarning(_("error capturing \"original\" tile image"),
|
wwarning(_("error capturing \"original\" tile image"),
|
||||||
RMessageForError(RErrorCode));
|
RMessageForError(RErrorCode));
|
||||||
}
|
}
|
||||||
tile = RCreateImageFromXImage(rc, original, NULL);
|
tile = RCreateImageFromXImage(rc, original, NULL);
|
||||||
|
|
||||||
XDestroyImage(original);
|
XDestroyImage(original);
|
||||||
XFreePixmap(WMScreenDisplay(scr), pix);
|
XFreePixmap(WMScreenDisplay(scr), pix);
|
||||||
|
|
||||||
pt = CLIP_BUTTON_SIZE*ICON_SIZE/64;
|
pt = CLIP_BUTTON_SIZE*ICON_SIZE/64;
|
||||||
tp = ICON_SIZE-1 - pt;
|
tp = ICON_SIZE-1 - pt;
|
||||||
@@ -797,8 +797,8 @@ renderClip(_Panel *panel, GC gc, int part, int relief)
|
|||||||
XFillPolygon(dpy, pix, WMColorGC(panel->colors[4]), p, 3, Convex, CoordModeOrigin);
|
XFillPolygon(dpy, pix, WMColorGC(panel->colors[4]), p, 3, Convex, CoordModeOrigin);
|
||||||
XDrawLines(dpy, pix, WMColorGC(panel->colors[4]), p, 4, CoordModeOrigin);
|
XDrawLines(dpy, pix, WMColorGC(panel->colors[4]), p, 4, CoordModeOrigin);
|
||||||
|
|
||||||
XCopyArea(dpy, pix, panel->preview, gc, 0, 0,
|
XCopyArea(dpy, pix, panel->preview, gc, 0, 0,
|
||||||
previewPositions[part].size.width,
|
previewPositions[part].size.width,
|
||||||
previewPositions[part].size.height,
|
previewPositions[part].size.height,
|
||||||
previewPositions[part].pos.x,
|
previewPositions[part].pos.x,
|
||||||
previewPositions[part].pos.y);
|
previewPositions[part].pos.y);
|
||||||
@@ -816,13 +816,13 @@ renderPreview(_Panel *panel, GC gc, int part, int relief)
|
|||||||
|
|
||||||
prop = GetObjectForKey(textureOptions[part]);
|
prop = GetObjectForKey(textureOptions[part]);
|
||||||
|
|
||||||
pix = renderTexture(scr, prop,
|
pix = renderTexture(scr, prop,
|
||||||
previewPositions[part].size.width,
|
previewPositions[part].size.width,
|
||||||
previewPositions[part].size.height,
|
previewPositions[part].size.height,
|
||||||
NULL, relief);
|
NULL, relief);
|
||||||
XCopyArea(WMScreenDisplay(scr), pix,
|
XCopyArea(WMScreenDisplay(scr), pix,
|
||||||
panel->preview, gc, 0, 0,
|
panel->preview, gc, 0, 0,
|
||||||
previewPositions[part].size.width,
|
previewPositions[part].size.width,
|
||||||
previewPositions[part].size.height,
|
previewPositions[part].size.height,
|
||||||
previewPositions[part].pos.x,
|
previewPositions[part].pos.x,
|
||||||
previewPositions[part].pos.y);
|
previewPositions[part].pos.y);
|
||||||
@@ -841,10 +841,10 @@ paintPreviewBox(Panel *panel, int elements)
|
|||||||
Pixmap mitem;
|
Pixmap mitem;
|
||||||
|
|
||||||
gc = XCreateGC(dpy, WMWidgetXID(panel->parent), 0, NULL);
|
gc = XCreateGC(dpy, WMWidgetXID(panel->parent), 0, NULL);
|
||||||
|
|
||||||
if (panel->preview == None) {
|
if (panel->preview == None) {
|
||||||
WMPixmap *pix;
|
WMPixmap *pix;
|
||||||
|
|
||||||
panel->preview = XCreatePixmap(dpy, WMWidgetXID(panel->parent),
|
panel->preview = XCreatePixmap(dpy, WMWidgetXID(panel->parent),
|
||||||
240-4, 190-4, WMScreenDepth(scr));
|
240-4, 190-4, WMScreenDepth(scr));
|
||||||
|
|
||||||
@@ -885,23 +885,23 @@ paintPreviewBox(Panel *panel, int elements)
|
|||||||
|
|
||||||
prop = GetObjectForKey(textureOptions[PMITEM]);
|
prop = GetObjectForKey(textureOptions[PMITEM]);
|
||||||
mitem = renderMenu(panel, prop,
|
mitem = renderMenu(panel, prop,
|
||||||
previewPositions[PMITEM].size.width,
|
previewPositions[PMITEM].size.width,
|
||||||
previewPositions[PMITEM].size.height/4);
|
previewPositions[PMITEM].size.height/4);
|
||||||
|
|
||||||
XCopyArea(dpy, mitem, panel->preview, gc, 0, 0,
|
XCopyArea(dpy, mitem, panel->preview, gc, 0, 0,
|
||||||
previewPositions[PMITEM].size.width,
|
previewPositions[PMITEM].size.width,
|
||||||
previewPositions[PMITEM].size.height,
|
previewPositions[PMITEM].size.height,
|
||||||
previewPositions[PMITEM].pos.x,
|
previewPositions[PMITEM].pos.x,
|
||||||
previewPositions[PMITEM].pos.y);
|
previewPositions[PMITEM].pos.y);
|
||||||
|
|
||||||
XFreePixmap(dpy, mitem);
|
XFreePixmap(dpy, mitem);
|
||||||
}
|
}
|
||||||
if (elements & (1<<PMITEM|1<<PMTITLE)) {
|
if (elements & (1<<PMITEM|1<<PMTITLE)) {
|
||||||
XDrawLine(dpy, panel->preview, gc, 29, 125, 29, 125+20*4+25);
|
XDrawLine(dpy, panel->preview, gc, 29, 125, 29, 125+20*4+25);
|
||||||
XDrawLine(dpy, panel->preview, gc, 119, 125, 119, 125+20*4+25);
|
XDrawLine(dpy, panel->preview, gc, 119, 125, 119, 125+20*4+25);
|
||||||
}
|
}
|
||||||
if (elements & (1<<PCLIP)) {
|
if (elements & (1<<PCLIP)) {
|
||||||
renderClip(panel, gc, PCLIP, RBEV_RAISED3);
|
renderClip(panel, gc, PCLIP, RBEV_RAISED3);
|
||||||
XDrawRectangle(dpy, panel->preview, WMColorGC(black),
|
XDrawRectangle(dpy, panel->preview, WMColorGC(black),
|
||||||
previewPositions[PCLIP].pos.x-1,
|
previewPositions[PCLIP].pos.x-1,
|
||||||
previewPositions[PCLIP].pos.y-1,
|
previewPositions[PCLIP].pos.y-1,
|
||||||
@@ -922,7 +922,7 @@ paintPreviewBox(Panel *panel, int elements)
|
|||||||
WMReleaseColor(black);
|
WMReleaseColor(black);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
paintTextField(void *data, int section)
|
paintTextField(void *data, int section)
|
||||||
{
|
{
|
||||||
_Panel *panel = (_Panel*)data;
|
_Panel *panel = (_Panel*)data;
|
||||||
@@ -932,45 +932,45 @@ paintTextField(void *data, int section)
|
|||||||
WMSetTextFieldFont(panel->fontT, getFontForPreview(panel, section));
|
WMSetTextFieldFont(panel->fontT, getFontForPreview(panel, section));
|
||||||
switch(encoding) {
|
switch(encoding) {
|
||||||
case 0: /* Current Font in theme */
|
case 0: /* Current Font in theme */
|
||||||
WMSetTextFieldText(panel->fontT,
|
WMSetTextFieldText(panel->fontT,
|
||||||
"ABCDEFGHIKLMNOPQRSTUVXYWZabcdefghiklmnopqrstuvxywz0123456789\x00e0\x00e6\x00e7\x00eb\x00ee\x00f0\x00f1\x00f3\x00f9\x00fd\x00c0\x00c6\x00c7\x00cb\x00ce\x00d0\x00d1\x00d3\x00d9\x00dd");
|
"ABCDEFGHIKLMNOPQRSTUVXYWZabcdefghiklmnopqrstuvxywz0123456789\x00e0\x00e6\x00e7\x00eb\x00ee\x00f0\x00f1\x00f3\x00f9\x00fd\x00c0\x00c6\x00c7\x00cb\x00ce\x00d0\x00d1\x00d3\x00d9\x00dd");
|
||||||
break;
|
break;
|
||||||
case 1: /* default */
|
case 1: /* default */
|
||||||
WMSetTextFieldText(panel->fontT, getFontSampleString(panel));
|
WMSetTextFieldText(panel->fontT, getFontSampleString(panel));
|
||||||
// "ABCDEFGHIKLMNOPQRSTUVXYWZabcdefghiklmnopqrstuvxywz0123456789\x00e0\x00e6\x00e7\x00eb\x00ee\x00f0\x00f1\x00f3\x00f9\x00fd\x00c0\x00c6\x00c7\x00cb\x00ce\x00d0\x00d1\x00d3\x00d9\x00dd");
|
// "ABCDEFGHIKLMNOPQRSTUVXYWZabcdefghiklmnopqrstuvxywz0123456789\x00e0\x00e6\x00e7\x00eb\x00ee\x00f0\x00f1\x00f3\x00f9\x00fd\x00c0\x00c6\x00c7\x00cb\x00ce\x00d0\x00d1\x00d3\x00d9\x00dd");
|
||||||
break;
|
break;
|
||||||
case 2: /* latin1 iso8859-1 */
|
case 2: /* latin1 iso8859-1 */
|
||||||
WMSetTextFieldText(panel->fontT, getFontSampleString(panel));
|
WMSetTextFieldText(panel->fontT, getFontSampleString(panel));
|
||||||
// "ABCDEFGHIKLMNOPQRSTUVXYWZabcdefghiklmnopqrstuvxywz0123456789\x00e0\x00e6\x00e7\x00eb\x00ee\x00f0\x00f1\x00f3\x00f9\x00fd\x00c0\x00c6\x00c7\x00cb\x00ce\x00d0\x00d1\x00d3\x00d9\x00dd");
|
// "ABCDEFGHIKLMNOPQRSTUVXYWZabcdefghiklmnopqrstuvxywz0123456789\x00e0\x00e6\x00e7\x00eb\x00ee\x00f0\x00f1\x00f3\x00f9\x00fd\x00c0\x00c6\x00c7\x00cb\x00ce\x00d0\x00d1\x00d3\x00d9\x00dd");
|
||||||
break;
|
break;
|
||||||
case 3: /* latin2 iso8859-2 */
|
case 3: /* latin2 iso8859-2 */
|
||||||
WMSetTextFieldText(panel->fontT, getFontSampleString(panel));
|
WMSetTextFieldText(panel->fontT, getFontSampleString(panel));
|
||||||
// "ABCDEFGHIKLMNOPQRSTUVXYWZabcdefghiklmnopqrstuvxywz0123456789\x00e0\x00e6\x00e7\x00eb\x00ee\x00f0\x00f1\x00f3\x00f9\x00fd\x00c0\x00c6\x00c7\x00cb\x00ce\x00d0\x00d1\x00d3\x00d9\x00dd");
|
// "ABCDEFGHIKLMNOPQRSTUVXYWZabcdefghiklmnopqrstuvxywz0123456789\x00e0\x00e6\x00e7\x00eb\x00ee\x00f0\x00f1\x00f3\x00f9\x00fd\x00c0\x00c6\x00c7\x00cb\x00ce\x00d0\x00d1\x00d3\x00d9\x00dd");
|
||||||
break;
|
break;
|
||||||
case 4: /* Greek iso8859-7 */
|
case 4: /* Greek iso8859-7 */
|
||||||
WMSetTextFieldText(panel->fontT, getFontSampleString(panel));
|
WMSetTextFieldText(panel->fontT, getFontSampleString(panel));
|
||||||
// "ABCDEFGHIKLMNOPQRSTUVXYWZabcdefghiklmnopqrstuvxywz0123456789\x00e0\x00e6\x00e7\x00eb\x00ee\x00f0\x00f1\x00f3\x00f9\x00fd\x00c0\x00c6\x00c7\x00cb\x00ce\x00d0\x00d1\x00d3\x00d9\x00dd");
|
// "ABCDEFGHIKLMNOPQRSTUVXYWZabcdefghiklmnopqrstuvxywz0123456789\x00e0\x00e6\x00e7\x00eb\x00ee\x00f0\x00f1\x00f3\x00f9\x00fd\x00c0\x00c6\x00c7\x00cb\x00ce\x00d0\x00d1\x00d3\x00d9\x00dd");
|
||||||
break;
|
break;
|
||||||
/* luckily all these happen to have the MultiByte chars in the same places */
|
/* luckily all these happen to have the MultiByte chars in the same places */
|
||||||
case 5: /* Japanese jisx0208.1983 */
|
case 5: /* Japanese jisx0208.1983 */
|
||||||
WMSetTextFieldText(panel->fontT, getFontSampleString(panel));
|
WMSetTextFieldText(panel->fontT, getFontSampleString(panel));
|
||||||
// "Window Maker 設定ユーティリティ");
|
// "Window Maker 設定ユーティリティ");
|
||||||
break;
|
break;
|
||||||
case 6: /* Korean ksc5601.1987 */
|
case 6: /* Korean ksc5601.1987 */
|
||||||
WMSetTextFieldText(panel->fontT, getFontSampleString(panel));
|
WMSetTextFieldText(panel->fontT, getFontSampleString(panel));
|
||||||
// "制亀酔 五戚朕 竺舛");
|
// "制亀酔 五戚朕 竺舛");
|
||||||
break;
|
break;
|
||||||
case 7: /* korean2 daewoo */
|
case 7: /* korean2 daewoo */
|
||||||
WMSetTextFieldText(panel->fontT, getFontSampleString(panel));
|
WMSetTextFieldText(panel->fontT, getFontSampleString(panel));
|
||||||
// "制亀酔 五戚朕 竺舛");
|
// "制亀酔 五戚朕 竺舛");
|
||||||
break;
|
break;
|
||||||
case 8: /* Russian koi8-r */
|
case 8: /* Russian koi8-r */
|
||||||
WMSetTextFieldText(panel->fontT, getFontSampleString(panel));
|
WMSetTextFieldText(panel->fontT, getFontSampleString(panel));
|
||||||
// "黐亙嘖彖 Window Maker");
|
// "黐亙嘖彖 Window Maker");
|
||||||
break;
|
break;
|
||||||
case 9: /* Ukranian koi8-u */
|
case 9: /* Ukranian koi8-u */
|
||||||
WMSetTextFieldText(panel->fontT, getFontSampleString(panel));
|
WMSetTextFieldText(panel->fontT, getFontSampleString(panel));
|
||||||
// "ABCDEFGHIKLMNOPQRSTUVXYWZabcdefghiklmnopqrstuvxywz0123456789\x00e0\x00e6\x00e7\x00eb\x00ee\x00f0\x00f1\x00f3\x00f9\x00fd\x00c0\x00c6\x00c7\x00cb\x00ce\x00d0\x00d1\x00d3\x00d9\x00dd");
|
// "ABCDEFGHIKLMNOPQRSTUVXYWZabcdefghiklmnopqrstuvxywz0123456789\x00e0\x00e6\x00e7\x00eb\x00ee\x00f0\x00f1\x00f3\x00f9\x00fd\x00c0\x00c6\x00c7\x00cb\x00ce\x00d0\x00d1\x00d3\x00d9\x00dd");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -984,11 +984,11 @@ previewClick(XEvent *event, void *clientData)
|
|||||||
for (i = 0; i < sizeof(previewPositions)/sizeof(WMRect); i++) {
|
for (i = 0; i < sizeof(previewPositions)/sizeof(WMRect); i++) {
|
||||||
if (event->xbutton.x >= previewPositions[i].pos.x
|
if (event->xbutton.x >= previewPositions[i].pos.x
|
||||||
&& event->xbutton.y >= previewPositions[i].pos.y
|
&& event->xbutton.y >= previewPositions[i].pos.y
|
||||||
&& event->xbutton.x < previewPositions[i].pos.x
|
&& event->xbutton.x < previewPositions[i].pos.x
|
||||||
+ previewPositions[i].size.width
|
+ previewPositions[i].size.width
|
||||||
&& event->xbutton.y < previewPositions[i].pos.y
|
&& event->xbutton.y < previewPositions[i].pos.y
|
||||||
+ previewPositions[i].size.height) {
|
+ previewPositions[i].size.height) {
|
||||||
|
|
||||||
WMSetPopUpButtonSelectedItem(panel->fontSel, i);
|
WMSetPopUpButtonSelectedItem(panel->fontSel, i);
|
||||||
changePage(panel->fontSel, panel);
|
changePage(panel->fontSel, panel);
|
||||||
return;
|
return;
|
||||||
@@ -1020,13 +1020,13 @@ changePage(WMWidget *w, void *data)
|
|||||||
|
|
||||||
color = WMCreateRGBColor(scr, 0x5100, 0x5100, 0x7100, True);
|
color = WMCreateRGBColor(scr, 0x5100, 0x5100, 0x7100, True);
|
||||||
XFillRectangle(rc->dpy, panel->preview, WMColorGC(color),
|
XFillRectangle(rc->dpy, panel->preview, WMColorGC(color),
|
||||||
positions[panel->oldsection].x,
|
positions[panel->oldsection].x,
|
||||||
positions[panel->oldsection].y, 22, 22);
|
positions[panel->oldsection].y, 22, 22);
|
||||||
WMReleaseColor(color);
|
WMReleaseColor(color);
|
||||||
}
|
}
|
||||||
if (w) {
|
if (w) {
|
||||||
panel->oldsection = section;
|
panel->oldsection = section;
|
||||||
WMDrawPixmap(panel->hand, panel->preview, positions[section].x,
|
WMDrawPixmap(panel->hand, panel->preview, positions[section].x,
|
||||||
positions[section].y);
|
positions[section].y);
|
||||||
}
|
}
|
||||||
WMRedisplayWidget(panel->prevL);
|
WMRedisplayWidget(panel->prevL);
|
||||||
@@ -1047,7 +1047,7 @@ setLanguageType(void *data, Bool multiByte)
|
|||||||
WMMapWidget(p->remB);
|
WMMapWidget(p->remB);
|
||||||
WMMapWidget(p->upB);
|
WMMapWidget(p->upB);
|
||||||
WMMapWidget(p->downB);
|
WMMapWidget(p->downB);
|
||||||
|
|
||||||
WMUnmapWidget(p->fontT);
|
WMUnmapWidget(p->fontT);
|
||||||
WMUnmapWidget(p->changeB);
|
WMUnmapWidget(p->changeB);
|
||||||
} else {
|
} else {
|
||||||
@@ -1058,7 +1058,7 @@ setLanguageType(void *data, Bool multiByte)
|
|||||||
WMUnmapWidget(p->remB);
|
WMUnmapWidget(p->remB);
|
||||||
WMUnmapWidget(p->upB);
|
WMUnmapWidget(p->upB);
|
||||||
WMUnmapWidget(p->downB);
|
WMUnmapWidget(p->downB);
|
||||||
|
|
||||||
WMMapWidget(p->fontT);
|
WMMapWidget(p->fontT);
|
||||||
WMMapWidget(p->changeB);
|
WMMapWidget(p->changeB);
|
||||||
}
|
}
|
||||||
@@ -1084,7 +1084,7 @@ refillFontSetList(void *data)
|
|||||||
} else {
|
} else {
|
||||||
for (i = 0; i < WMGetPropListItemCount(array); i++) {
|
for (i = 0; i < WMGetPropListItemCount(array); i++) {
|
||||||
WMGetFromPLArray(array, i);
|
WMGetFromPLArray(array, i);
|
||||||
WMAddListItem( panel->fsetLs,
|
WMAddListItem( panel->fsetLs,
|
||||||
WMGetFromPLString(
|
WMGetFromPLString(
|
||||||
WMGetFromPLArray(array, i)));
|
WMGetFromPLArray(array, i)));
|
||||||
}
|
}
|
||||||
@@ -1113,7 +1113,7 @@ insertCurrentFont(char *data, char *type)
|
|||||||
}
|
}
|
||||||
wfree(str);
|
wfree(str);
|
||||||
|
|
||||||
|
|
||||||
WMPutInPLDictionary(CurrentFontArray, key, array);
|
WMPutInPLDictionary(CurrentFontArray, key, array);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1130,7 +1130,7 @@ readFontEncodings(void *data)
|
|||||||
msg = _("Could not locate font information file WPrefs.app/font.data");
|
msg = _("Could not locate font information file WPrefs.app/font.data");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
pl = WMReadPropListFromFile(path);
|
pl = WMReadPropListFromFile(path);
|
||||||
if (!pl) {
|
if (!pl) {
|
||||||
msg = _("Could not read font information file WPrefs.app/font.data");
|
msg = _("Could not read font information file WPrefs.app/font.data");
|
||||||
@@ -1140,7 +1140,7 @@ readFontEncodings(void *data)
|
|||||||
WMPropList *key = WMCreatePLString("Encodings");
|
WMPropList *key = WMCreatePLString("Encodings");
|
||||||
WMPropList *array;
|
WMPropList *array;
|
||||||
WMMenuItem *mi;
|
WMMenuItem *mi;
|
||||||
|
|
||||||
array = WMGetFromPLDictionary(pl, key);
|
array = WMGetFromPLDictionary(pl, key);
|
||||||
WMReleasePropList(key);
|
WMReleasePropList(key);
|
||||||
if (!array || !WMIsPLArray(array)) {
|
if (!array || !WMIsPLArray(array)) {
|
||||||
@@ -1150,7 +1150,7 @@ readFontEncodings(void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
WMAddPopUpButtonItem(panel->langP, _("Current"));
|
WMAddPopUpButtonItem(panel->langP, _("Current"));
|
||||||
|
|
||||||
for (i = 0; i < WMGetPropListItemCount(array); i++) {
|
for (i = 0; i < WMGetPropListItemCount(array); i++) {
|
||||||
WMPropList *item, *str;
|
WMPropList *item, *str;
|
||||||
|
|
||||||
@@ -1161,11 +1161,11 @@ readFontEncodings(void *data)
|
|||||||
}
|
}
|
||||||
WMSetPopUpButtonSelectedItem(panel->langP, 0);
|
WMSetPopUpButtonSelectedItem(panel->langP, 0);
|
||||||
|
|
||||||
|
|
||||||
key = WMCreatePLString("WindowTitleFont");
|
key = WMCreatePLString("WindowTitleFont");
|
||||||
DefaultWindowTitleFont = WMRetainPropList(WMGetFromPLDictionary(pl, key));
|
DefaultWindowTitleFont = WMRetainPropList(WMGetFromPLDictionary(pl, key));
|
||||||
WMReleasePropList(key);
|
WMReleasePropList(key);
|
||||||
|
|
||||||
key = WMCreatePLString("MenuTitleFont");
|
key = WMCreatePLString("MenuTitleFont");
|
||||||
DefaultMenuTitleFont = WMRetainPropList(WMGetFromPLDictionary(pl, key));
|
DefaultMenuTitleFont = WMRetainPropList(WMGetFromPLDictionary(pl, key));
|
||||||
WMReleasePropList(key);
|
WMReleasePropList(key);
|
||||||
@@ -1193,20 +1193,20 @@ error:
|
|||||||
if (pl)
|
if (pl)
|
||||||
WMReleasePropList(pl);
|
WMReleasePropList(pl);
|
||||||
|
|
||||||
WMRunAlertPanel(WMWidgetScreen(panel->parent), panel->parent,
|
WMRunAlertPanel(WMWidgetScreen(panel->parent), panel->parent,
|
||||||
_("Error"), msg, _("OK"), NULL, NULL);
|
_("Error"), msg, _("OK"), NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
checkListForArrows(void *data)
|
checkListForArrows(void *data)
|
||||||
{
|
{
|
||||||
_Panel *panel = (_Panel*)data;
|
_Panel *panel = (_Panel*)data;
|
||||||
int list;
|
int list;
|
||||||
list = WMGetListNumberOfRows(panel->fsetLs);
|
list = WMGetListNumberOfRows(panel->fsetLs);
|
||||||
|
|
||||||
if(list > 1)
|
if(list > 1)
|
||||||
{
|
{
|
||||||
if(WMGetListSelectedItemRow(panel->fsetLs) == 0) {
|
if(WMGetListSelectedItemRow(panel->fsetLs) == 0) {
|
||||||
WMSetButtonEnabled(panel->upB, False);
|
WMSetButtonEnabled(panel->upB, False);
|
||||||
WMSetButtonEnabled(panel->downB, True);
|
WMSetButtonEnabled(panel->downB, True);
|
||||||
} else if(WMGetListSelectedItemRow(panel->fsetLs) == list-1) {
|
} else if(WMGetListSelectedItemRow(panel->fsetLs) == list-1) {
|
||||||
@@ -1222,9 +1222,9 @@ checkListForArrows(void *data)
|
|||||||
WMSetButtonEnabled(panel->downB, False);
|
WMSetButtonEnabled(panel->downB, False);
|
||||||
}
|
}
|
||||||
/* added to control the Remove button */
|
/* added to control the Remove button */
|
||||||
if(list > 1)
|
if(list > 1)
|
||||||
WMSetButtonEnabled(panel->remB, True);
|
WMSetButtonEnabled(panel->remB, True);
|
||||||
else
|
else
|
||||||
WMSetButtonEnabled(panel->remB, False);
|
WMSetButtonEnabled(panel->remB, False);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1238,14 +1238,14 @@ fontOfLang(void *data, char *encoding, int section)
|
|||||||
|
|
||||||
if(!encoding)
|
if(!encoding)
|
||||||
array = getCurrentFontProp(panel, section);
|
array = getCurrentFontProp(panel, section);
|
||||||
else
|
else
|
||||||
array = getDefaultFontProp(panel, encoding, section);
|
array = getDefaultFontProp(panel, encoding, section);
|
||||||
|
|
||||||
if(!array) {
|
if(!array) {
|
||||||
wwarning("error no font prop given");
|
wwarning("error no font prop given");
|
||||||
return NULL;
|
return NULL;
|
||||||
} else {
|
} else {
|
||||||
for(i=0; i<WMGetPropListItemCount(array); i++)
|
for(i=0; i<WMGetPropListItemCount(array); i++)
|
||||||
{
|
{
|
||||||
if(buf) buf = wstrconcat(buf, ",");
|
if(buf) buf = wstrconcat(buf, ",");
|
||||||
buf = wstrconcat(buf, WMGetFromPLString(WMGetFromPLArray(array, i)));
|
buf = wstrconcat(buf, WMGetFromPLString(WMGetFromPLArray(array, i)));
|
||||||
@@ -1264,7 +1264,7 @@ changeLanguageAction(WMWidget *w, void *data)
|
|||||||
|
|
||||||
section = WMGetPopUpButtonSelectedItem(w);
|
section = WMGetPopUpButtonSelectedItem(w);
|
||||||
|
|
||||||
if(isEncodingMultiByte(panel)) {
|
if(isEncodingMultiByte(panel)) {
|
||||||
setLanguageType(panel, True);
|
setLanguageType(panel, True);
|
||||||
} else {
|
} else {
|
||||||
if(panel->MultiByteText) setLanguageType(panel, True);
|
if(panel->MultiByteText) setLanguageType(panel, True);
|
||||||
@@ -1279,34 +1279,34 @@ static WMFont*
|
|||||||
getFontForPreview(void *data, int element)
|
getFontForPreview(void *data, int element)
|
||||||
{
|
{
|
||||||
_Panel *panel = (_Panel*)data;
|
_Panel *panel = (_Panel*)data;
|
||||||
WMFont *font;
|
WMFont *font;
|
||||||
char *fname;
|
char *fname;
|
||||||
WMScreen *scr = WMWidgetScreen(panel->box);
|
WMScreen *scr = WMWidgetScreen(panel->box);
|
||||||
char *encoding = getFontEncoding(panel);
|
char *encoding = getFontEncoding(panel);
|
||||||
fname = fontOfLang(panel, encoding, element);
|
fname = fontOfLang(panel, encoding, element);
|
||||||
if (WMHasAntialiasingSupport(scr))
|
//if (WMHasAntialiasingSupport(scr)) {
|
||||||
{
|
|
||||||
if(panel->AntialiasedText) {
|
if(panel->AntialiasedText) {
|
||||||
font = WMCreateFontWithFlags(scr, fname, WFAntialiased);
|
// fix this -Dan font = WMCreateFontWithFlags(scr, fname, WFAntialiased);
|
||||||
|
font = WMCreateFont(scr, fname);
|
||||||
} else {
|
} else {
|
||||||
font = WMCreateFont(scr, fname);
|
font = WMCreateFont(scr, fname);
|
||||||
}
|
}
|
||||||
} else {
|
//} else {
|
||||||
font = WMCreateFont(scr, fname);
|
// font = WMCreateFont(scr, fname);
|
||||||
}
|
//}
|
||||||
if(!font) {
|
if(!font) {
|
||||||
char *msg;
|
char *msg;
|
||||||
int length;
|
int length;
|
||||||
length = strlen("\"")+
|
length = strlen("\"")+
|
||||||
strlen(fname)+strlen("\" was not loaded correctly. Make sure the font is available for that encoding.\nLoadind default system font.");
|
strlen(fname)+strlen("\" was not loaded correctly. Make sure the font is available for that encoding.\nLoadind default system font.");
|
||||||
msg = wmalloc(length +1);
|
msg = wmalloc(length +1);
|
||||||
snprintf(msg, length + 1,
|
snprintf(msg, length + 1,
|
||||||
"\"%s\" was not loaded correctly. Make sure the font is available for that encoding.\nLoading default system font.",
|
"\"%s\" was not loaded correctly. Make sure the font is available for that encoding.\nLoading default system font.",
|
||||||
fname);
|
fname);
|
||||||
WMRunAlertPanel(WMWidgetScreen(panel->parent),panel->parent,
|
WMRunAlertPanel(WMWidgetScreen(panel->parent),panel->parent,
|
||||||
_("Warning"), msg, _("OK"), NULL, NULL);
|
_("Warning"), msg, _("OK"), NULL, NULL);
|
||||||
font = getDefaultSystemFont(panel, element);
|
font = getDefaultSystemFont(panel, element);
|
||||||
}
|
}
|
||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1393,17 +1393,17 @@ getCurrentFontProp(void *data, int section)
|
|||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
array = WMRetainPropList(
|
array = WMRetainPropList(
|
||||||
WMGetFromPLDictionary(CurrentFontArray,
|
WMGetFromPLDictionary(CurrentFontArray,
|
||||||
WMCreatePLString("LargeDisplayFont")));
|
WMCreatePLString("LargeDisplayFont")));
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
array = WMRetainPropList(
|
array = WMRetainPropList(
|
||||||
WMGetFromPLDictionary(CurrentFontArray,
|
WMGetFromPLDictionary(CurrentFontArray,
|
||||||
WMCreatePLString("MenuTitleFont")));
|
WMCreatePLString("MenuTitleFont")));
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
array = WMRetainPropList(
|
array = WMRetainPropList(
|
||||||
WMGetFromPLDictionary(CurrentFontArray,
|
WMGetFromPLDictionary(CurrentFontArray,
|
||||||
WMCreatePLString("MenuTextFont")));
|
WMCreatePLString("MenuTextFont")));
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
@@ -1413,7 +1413,7 @@ getCurrentFontProp(void *data, int section)
|
|||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
array = WMRetainPropList(
|
array = WMRetainPropList(
|
||||||
WMGetFromPLDictionary(CurrentFontArray,
|
WMGetFromPLDictionary(CurrentFontArray,
|
||||||
WMCreatePLString("IconTitleFont")));
|
WMCreatePLString("IconTitleFont")));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1511,7 +1511,7 @@ multiClick(WMWidget *w, void *data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
toggleAA(WMWidget *w, void *data)
|
toggleAA(WMWidget *w, void *data)
|
||||||
{
|
{
|
||||||
_Panel *panel = (_Panel*)data;
|
_Panel *panel = (_Panel*)data;
|
||||||
@@ -1521,18 +1521,18 @@ toggleAA(WMWidget *w, void *data)
|
|||||||
else
|
else
|
||||||
panel->AntialiasedText = True;
|
panel->AntialiasedText = True;
|
||||||
/* hmm now i gotta redraw all the fonts in the preview section
|
/* hmm now i gotta redraw all the fonts in the preview section
|
||||||
* and the text field
|
* and the text field
|
||||||
*/
|
*/
|
||||||
paintPreviewBox(panel, EVERYTHING);
|
paintPreviewBox(panel, EVERYTHING);
|
||||||
changePage(panel->fontSel, panel);
|
changePage(panel->fontSel, panel);
|
||||||
if(isEncodingMultiByte(panel)) setLanguageType(panel, True);
|
if(isEncodingMultiByte(panel)) setLanguageType(panel, True);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
listClick(WMWidget *w, void *data)
|
listClick(WMWidget *w, void *data)
|
||||||
{
|
{
|
||||||
_Panel *panel = (_Panel*)data;
|
_Panel *panel = (_Panel*)data;
|
||||||
|
|
||||||
checkListForArrows(panel);
|
checkListForArrows(panel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1704,11 +1704,11 @@ removeButtonClick(WMWidget *w, void *data)
|
|||||||
|
|
||||||
list = WMGetListNumberOfRows(panel->fsetLs);
|
list = WMGetListNumberOfRows(panel->fsetLs);
|
||||||
if(list != 0) {
|
if(list != 0) {
|
||||||
if(list > pos)
|
if(list > pos)
|
||||||
WMSelectListItem(panel->fsetLs, pos);
|
WMSelectListItem(panel->fsetLs, pos);
|
||||||
else if(list == pos)
|
else if(list == pos)
|
||||||
WMSelectListItem(panel->fsetLs, list-1);
|
WMSelectListItem(panel->fsetLs, list-1);
|
||||||
else
|
else
|
||||||
WMSelectListItem(panel->fsetLs, 0);
|
WMSelectListItem(panel->fsetLs, 0);
|
||||||
}
|
}
|
||||||
checkListForArrows(panel);
|
checkListForArrows(panel);
|
||||||
@@ -1723,15 +1723,15 @@ showData(_Panel *panel)
|
|||||||
WMScreen *scr = WMWidgetScreen(panel->parent);
|
WMScreen *scr = WMWidgetScreen(panel->parent);
|
||||||
char *str;
|
char *str;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
CurrentFontArray = WMCreatePLDictionary(NULL, NULL);
|
CurrentFontArray = WMCreatePLDictionary(NULL, NULL);
|
||||||
|
|
||||||
str = GetStringForKey("WindowTitleFont");
|
str = GetStringForKey("WindowTitleFont");
|
||||||
insertCurrentFont(wstrdup(str), "WindowTitleFont");
|
insertCurrentFont(wstrdup(str), "WindowTitleFont");
|
||||||
|
|
||||||
str = GetStringForKey("LargeDisplayFont");
|
str = GetStringForKey("LargeDisplayFont");
|
||||||
insertCurrentFont(wstrdup(str), "LargeDisplayFont");
|
insertCurrentFont(wstrdup(str), "LargeDisplayFont");
|
||||||
|
|
||||||
str = GetStringForKey("MenuTitleFont");
|
str = GetStringForKey("MenuTitleFont");
|
||||||
insertCurrentFont(wstrdup(str), "MenuTitleFont");
|
insertCurrentFont(wstrdup(str), "MenuTitleFont");
|
||||||
|
|
||||||
@@ -1785,56 +1785,55 @@ showData(_Panel *panel)
|
|||||||
WMSetButtonText(panel->togMulti, "Yes");
|
WMSetButtonText(panel->togMulti, "Yes");
|
||||||
printf("yes multi\n");
|
printf("yes multi\n");
|
||||||
panel->MultiByteText = True;
|
panel->MultiByteText = True;
|
||||||
} else if (strcasecmp(str, "AUTO") == 0) {
|
} else if (strcasecmp(str, "AUTO") == 0) {
|
||||||
char *locale;
|
char *locale;
|
||||||
locale = setlocale(LC_CTYPE, NULL);
|
locale = setlocale(LC_CTYPE, NULL);
|
||||||
if(locale != NULL
|
if(locale != NULL
|
||||||
&& (strncmp(locale, "ja", 2) == 0
|
&& (strncmp(locale, "ja", 2) == 0
|
||||||
|| strncmp(locale, "zh", 2) == 0
|
|| strncmp(locale, "zh", 2) == 0
|
||||||
|| strncmp(locale, "ko", 2) == 0)) {
|
|| strncmp(locale, "ko", 2) == 0)) {
|
||||||
setLanguageType(panel, True);
|
setLanguageType(panel, True);
|
||||||
WMSetButtonText(panel->togMulti, "Auto");
|
WMSetButtonText(panel->togMulti, "Auto");
|
||||||
printf("auto multi\n");
|
printf("auto multi\n");
|
||||||
panel->MultiByteText = True;
|
panel->MultiByteText = True;
|
||||||
} else {
|
} else {
|
||||||
setLanguageType(panel, False);
|
setLanguageType(panel, False);
|
||||||
WMSetButtonText(panel->togMulti, "Auto");
|
WMSetButtonText(panel->togMulti, "Auto");
|
||||||
panel->MultiByteText = False;
|
panel->MultiByteText = False;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
char *locale;
|
char *locale;
|
||||||
locale = setlocale(LC_CTYPE, NULL);
|
locale = setlocale(LC_CTYPE, NULL);
|
||||||
if(locale != NULL
|
if(locale != NULL
|
||||||
&& (strncmp(locale, "ja", 2) == 0
|
&& (strncmp(locale, "ja", 2) == 0
|
||||||
|| strncmp(locale, "zh", 2) == 0
|
|| strncmp(locale, "zh", 2) == 0
|
||||||
|| strncmp(locale, "ko", 2) == 0)) {
|
|| strncmp(locale, "ko", 2) == 0)) {
|
||||||
setLanguageType(panel, True);
|
setLanguageType(panel, True);
|
||||||
WMSetButtonText(panel->togMulti, "Auto");
|
WMSetButtonText(panel->togMulti, "Auto");
|
||||||
printf("auto multi\n");
|
printf("auto multi\n");
|
||||||
panel->MultiByteText = True;
|
panel->MultiByteText = True;
|
||||||
} else {
|
} else {
|
||||||
setLanguageType(panel, False);
|
setLanguageType(panel, False);
|
||||||
WMSetButtonText(panel->togMulti, "Auto");
|
WMSetButtonText(panel->togMulti, "Auto");
|
||||||
panel->MultiByteText = False;
|
panel->MultiByteText = False;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* gotta check for Antialiasing AFTER MultiByte incase the use has both
|
/* gotta check for Antialiasing AFTER MultiByte incase the use has both
|
||||||
* to maintain behavior in Current Fonts set or i could add another if
|
* to maintain behavior in Current Fonts set or i could add another if
|
||||||
* statement to setLanguageType =) */
|
* statement to setLanguageType =) */
|
||||||
if (WMHasAntialiasingSupport(scr))
|
//if (WMHasAntialiasingSupport(scr)) {
|
||||||
{
|
|
||||||
WMMapWidget(panel->togAA);
|
WMMapWidget(panel->togAA);
|
||||||
if(GetBoolForKey("AntialiasedText")){
|
if(GetBoolForKey("AntialiasedText")){
|
||||||
WMSetButtonSelected(panel->togAA, True);
|
WMSetButtonSelected(panel->togAA, True);
|
||||||
panel->AntialiasedText = True;
|
panel->AntialiasedText = True;
|
||||||
} else {
|
} else {
|
||||||
WMSetButtonSelected(panel->togAA, False);
|
WMSetButtonSelected(panel->togAA, False);
|
||||||
panel->AntialiasedText = False;
|
panel->AntialiasedText = False;
|
||||||
}
|
}
|
||||||
} else {
|
//} else {
|
||||||
WMUnmapWidget(panel->togAA);
|
// WMUnmapWidget(panel->togAA);
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
|
||||||
paintPreviewBox(panel, EVERYTHING);
|
paintPreviewBox(panel, EVERYTHING);
|
||||||
@@ -1842,14 +1841,14 @@ showData(_Panel *panel)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
createPanel(Panel *p)
|
createPanel(Panel *p)
|
||||||
{
|
{
|
||||||
_Panel *panel = (_Panel*)p;
|
_Panel *panel = (_Panel*)p;
|
||||||
WMScreen *scr = WMWidgetScreen(panel->parent);
|
WMScreen *scr = WMWidgetScreen(panel->parent);
|
||||||
|
|
||||||
|
|
||||||
panel->box = WMCreateBox(panel->parent);
|
panel->box = WMCreateBox(panel->parent);
|
||||||
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
|
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
|
||||||
|
|
||||||
panel->hand = WMCreatePixmapFromXPMData(scr, hand_xpm);
|
panel->hand = WMCreatePixmapFromXPMData(scr, hand_xpm);
|
||||||
panel->up_arrow = WMCreatePixmapFromXPMData(scr, up_arrow_xpm);
|
panel->up_arrow = WMCreatePixmapFromXPMData(scr, up_arrow_xpm);
|
||||||
panel->down_arrow = WMCreatePixmapFromXPMData(scr, down_arrow_xpm);
|
panel->down_arrow = WMCreatePixmapFromXPMData(scr, down_arrow_xpm);
|
||||||
@@ -1893,7 +1892,7 @@ createPanel(Panel *p)
|
|||||||
WMSetButtonAction(panel->togMulti, multiClick, panel);
|
WMSetButtonAction(panel->togMulti, multiClick, panel);
|
||||||
|
|
||||||
WMMapSubwidgets(panel->multiF);
|
WMMapSubwidgets(panel->multiF);
|
||||||
|
|
||||||
/* language selection */
|
/* language selection */
|
||||||
panel->langF = WMCreateFrame(panel->box);
|
panel->langF = WMCreateFrame(panel->box);
|
||||||
WMResizeWidget(panel->langF, 165, 50);
|
WMResizeWidget(panel->langF, 165, 50);
|
||||||
@@ -1909,17 +1908,16 @@ createPanel(Panel *p)
|
|||||||
WMMapSubwidgets(panel->langF);
|
WMMapSubwidgets(panel->langF);
|
||||||
|
|
||||||
/* Antialiasing */
|
/* Antialiasing */
|
||||||
if (WMHasAntialiasingSupport(scr))
|
//if (WMHasAntialiasingSupport(scr)) {
|
||||||
{
|
panel->togAA = WMCreateSwitchButton(panel->box);
|
||||||
panel->togAA = WMCreateSwitchButton(panel->box);
|
WMResizeWidget(panel->togAA, 110, 20);
|
||||||
WMResizeWidget(panel->togAA, 110, 20);
|
WMMoveWidget(panel->togAA, 155, 10);
|
||||||
WMMoveWidget(panel->togAA, 155, 10);
|
WMSetButtonText(panel->togAA, _("Smooth Fonts"));
|
||||||
WMSetButtonText(panel->togAA, _("Smooth Fonts"));
|
WMSetBalloonTextForView(_("Smooth Font edges for the eye candy\n"
|
||||||
WMSetBalloonTextForView(_("Smooth Font edges for the eye candy\n"
|
"requires a restart after saving"),
|
||||||
"requires a restart after saving"),
|
WMWidgetView(panel->togAA));
|
||||||
WMWidgetView(panel->togAA));
|
WMSetButtonAction(panel->togAA, toggleAA, panel);
|
||||||
WMSetButtonAction(panel->togAA, toggleAA, panel);
|
//}
|
||||||
}
|
|
||||||
/* multibyte */
|
/* multibyte */
|
||||||
panel->fsetL = WMCreateLabel(panel->box);
|
panel->fsetL = WMCreateLabel(panel->box);
|
||||||
WMResizeWidget(panel->fsetL, 245, 20);
|
WMResizeWidget(panel->fsetL, 245, 20);
|
||||||
@@ -1930,16 +1928,16 @@ createPanel(Panel *p)
|
|||||||
{
|
{
|
||||||
WMFont *font;
|
WMFont *font;
|
||||||
WMColor *color;
|
WMColor *color;
|
||||||
|
|
||||||
color = WMDarkGrayColor(scr);
|
color = WMDarkGrayColor(scr);
|
||||||
font = WMBoldSystemFontOfSize(scr, 12);
|
font = WMBoldSystemFontOfSize(scr, 12);
|
||||||
|
|
||||||
WMSetWidgetBackgroundColor(panel->fsetL, color);
|
WMSetWidgetBackgroundColor(panel->fsetL, color);
|
||||||
WMSetLabelFont(panel->fsetL, font);
|
WMSetLabelFont(panel->fsetL, font);
|
||||||
|
|
||||||
WMReleaseFont(font);
|
WMReleaseFont(font);
|
||||||
WMReleaseColor(color);
|
WMReleaseColor(color);
|
||||||
|
|
||||||
color = WMWhiteColor(scr);
|
color = WMWhiteColor(scr);
|
||||||
WMSetLabelTextColor(panel->fsetL, color);
|
WMSetLabelTextColor(panel->fsetL, color);
|
||||||
WMReleaseColor(color);
|
WMReleaseColor(color);
|
||||||
@@ -1992,24 +1990,24 @@ createPanel(Panel *p)
|
|||||||
panel->fontT = WMCreateTextField(panel->box);
|
panel->fontT = WMCreateTextField(panel->box);
|
||||||
WMResizeWidget(panel->fontT, 245, 30);
|
WMResizeWidget(panel->fontT, 245, 30);
|
||||||
WMMoveWidget(panel->fontT, 265, 120);
|
WMMoveWidget(panel->fontT, 265, 120);
|
||||||
|
|
||||||
panel->changeB = WMCreateCommandButton(panel->box);
|
panel->changeB = WMCreateCommandButton(panel->box);
|
||||||
WMResizeWidget(panel->changeB, 104, 24);
|
WMResizeWidget(panel->changeB, 104, 24);
|
||||||
WMMoveWidget(panel->changeB, 335, 160);
|
WMMoveWidget(panel->changeB, 335, 160);
|
||||||
WMSetButtonText(panel->changeB, _("Change..."));
|
WMSetButtonText(panel->changeB, _("Change..."));
|
||||||
WMSetButtonAction(panel->changeB, changeButtonClick, panel);
|
WMSetButtonAction(panel->changeB, changeButtonClick, panel);
|
||||||
|
|
||||||
|
|
||||||
panel->black = WMBlackColor(scr);
|
panel->black = WMBlackColor(scr);
|
||||||
panel->white = WMWhiteColor(scr);
|
panel->white = WMWhiteColor(scr);
|
||||||
panel->light = WMGrayColor(scr);
|
panel->light = WMGrayColor(scr);
|
||||||
panel->dark = WMDarkGrayColor(scr);
|
panel->dark = WMDarkGrayColor(scr);
|
||||||
panel->back = WMCreateRGBColor(scr, 0x5100, 0x5100, 0x7100, True);
|
panel->back = WMCreateRGBColor(scr, 0x5100, 0x5100, 0x7100, True);
|
||||||
|
|
||||||
/* Font Panel !!!!! */
|
/* Font Panel !!!!! */
|
||||||
panel->fontPanel = WMGetFontPanel(scr);
|
panel->fontPanel = WMGetFontPanel(scr);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
for (i = 0; Languages[i].language != NULL; i++) {
|
for (i = 0; Languages[i].language != NULL; i++) {
|
||||||
WMAddPopUpButtonItem(panel->langP, Languages[i].language);
|
WMAddPopUpButtonItem(panel->langP, Languages[i].language);
|
||||||
}
|
}
|
||||||
@@ -2037,33 +2035,33 @@ storeData(Panel *p)
|
|||||||
{
|
{
|
||||||
switch(i) {
|
switch(i) {
|
||||||
case 0:
|
case 0:
|
||||||
SetStringForKey(fontOfLang(panel, encoding, i),
|
SetStringForKey(fontOfLang(panel, encoding, i),
|
||||||
"WindowTitleFont");
|
"WindowTitleFont");
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
SetStringForKey(fontOfLang(panel, encoding, i),
|
SetStringForKey(fontOfLang(panel, encoding, i),
|
||||||
"LargeDisplayFont");
|
"LargeDisplayFont");
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
SetStringForKey(fontOfLang(panel, encoding, i),
|
SetStringForKey(fontOfLang(panel, encoding, i),
|
||||||
"MenuTitleFont");
|
"MenuTitleFont");
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
SetStringForKey(fontOfLang(panel, encoding, i),
|
SetStringForKey(fontOfLang(panel, encoding, i),
|
||||||
"MenuTextFont");
|
"MenuTextFont");
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
SetStringForKey(fontOfLang(panel, encoding, i),
|
SetStringForKey(fontOfLang(panel, encoding, i),
|
||||||
"ClipTitleFont");
|
"ClipTitleFont");
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
SetStringForKey(fontOfLang(panel, encoding, i),
|
SetStringForKey(fontOfLang(panel, encoding, i),
|
||||||
"IconTitleFont");
|
"IconTitleFont");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WMHasAntialiasingSupport(WMWidgetScreen(panel->box)))
|
//if (WMHasAntialiasingSupport(WMWidgetScreen(panel->box)))
|
||||||
SetBoolForKey(WMGetButtonSelected(panel->togAA), "AntialiasedText");
|
SetBoolForKey(WMGetButtonSelected(panel->togAA), "AntialiasedText");
|
||||||
|
|
||||||
if(panel->MultiByteText)
|
if(panel->MultiByteText)
|
||||||
@@ -2080,8 +2078,8 @@ prepClosure(Panel *p)
|
|||||||
_Panel *panel = (_Panel*)p;
|
_Panel *panel = (_Panel*)p;
|
||||||
WMFreeFontPanel(panel->fontPanel);
|
WMFreeFontPanel(panel->fontPanel);
|
||||||
WMReleasePropList(CurrentFontArray);
|
WMReleasePropList(CurrentFontArray);
|
||||||
/* and what ever else i've forgotten or overlooked
|
/* and what ever else i've forgotten or overlooked
|
||||||
* maybe someone will add them */
|
* maybe someone will add them */
|
||||||
}
|
}
|
||||||
|
|
||||||
Panel*
|
Panel*
|
||||||
@@ -2096,13 +2094,13 @@ InitFont(WMScreen *scr, WMWidget *parent)
|
|||||||
panel->description = _("Font Configurations for Windows, Menus etc");
|
panel->description = _("Font Configurations for Windows, Menus etc");
|
||||||
|
|
||||||
panel->parent = parent;
|
panel->parent = parent;
|
||||||
|
|
||||||
panel->callbacks.createWidgets = createPanel;
|
panel->callbacks.createWidgets = createPanel;
|
||||||
panel->callbacks.updateDomain = storeData;
|
panel->callbacks.updateDomain = storeData;
|
||||||
panel->callbacks.prepareForClose = prepClosure;
|
panel->callbacks.prepareForClose = prepClosure;
|
||||||
|
|
||||||
AddSection(panel, ICON_FILE);
|
AddSection(panel, ICON_FILE);
|
||||||
|
|
||||||
return panel;
|
return panel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
AC_PROG_LIBTOOL
|
||||||
|
|
||||||
@@ -102,8 +102,8 @@ AC_FUNC_VPRINTF
|
|||||||
AC_FUNC_ALLOCA
|
AC_FUNC_ALLOCA
|
||||||
AC_CHECK_FUNCS(gethostname select poll strerror strcasecmp strncasecmp \
|
AC_CHECK_FUNCS(gethostname select poll strerror strcasecmp strncasecmp \
|
||||||
setsid atexit mallinfo mkstemp snprintf vsnprintf asprintf \
|
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 ripped from samba
|
||||||
dnl
|
dnl
|
||||||
|
|||||||
@@ -1312,7 +1312,8 @@ wShowInfoPanel(WScreen *scr)
|
|||||||
WMSetLabelTextAlignment(panel->copyrL, WALeft);
|
WMSetLabelTextAlignment(panel->copyrL, WALeft);
|
||||||
WMSetLabelText(panel->copyrL, COPYRIGHT_TEXT);
|
WMSetLabelText(panel->copyrL, COPYRIGHT_TEXT);
|
||||||
/* we want the (c) character in the font, so don't use a FontSet here */
|
/* 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) {
|
if (font) {
|
||||||
WMSetLabelFont(panel->copyrL, font);
|
WMSetLabelFont(panel->copyrL, font);
|
||||||
WMReleaseFont(font);
|
WMReleaseFont(font);
|
||||||
|
|||||||
@@ -821,9 +821,11 @@ wScreenInit(int screen_number)
|
|||||||
|
|
||||||
scr->info_text_font = WMBoldSystemFontOfSize(scr->wmscreen, 12);
|
scr->info_text_font = WMBoldSystemFontOfSize(scr->wmscreen, 12);
|
||||||
|
|
||||||
scr->tech_draw_font = WMCreateFontWithFlags(scr->wmscreen,
|
// fix this too -Dan
|
||||||
"BoldSystemFont-12",
|
//scr->tech_draw_font = WMCreateFontWithFlags(scr->wmscreen,
|
||||||
WFNotAntialiased);
|
// "BoldSystemFont-12",
|
||||||
|
// WFNotAntialiased);
|
||||||
|
scr->tech_draw_font = WMBoldSystemFontOfSize(scr->wmscreen, 12);
|
||||||
|
|
||||||
scr->gview = WCreateGeometryView(scr->wmscreen);
|
scr->gview = WCreateGeometryView(scr->wmscreen);
|
||||||
WMRealizeWidget(scr->gview);
|
WMRealizeWidget(scr->gview);
|
||||||
|
|||||||
Reference in New Issue
Block a user