mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-20 04:48:06 +01:00
added some netwm support in WINGs
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
Changes since version 0.90.0:
|
||||||
|
.............................
|
||||||
|
|
||||||
|
- added _NET_WM_NAME, _ICON_NAME and _ICON to WINGs
|
||||||
|
|
||||||
Changes since version 0.80.2:
|
Changes since version 0.80.2:
|
||||||
.............................
|
.............................
|
||||||
|
|
||||||
|
|||||||
@@ -963,6 +963,8 @@ void WMSetWindowTitle(WMWindow *wPtr, char *title);
|
|||||||
|
|
||||||
void WMSetWindowMiniwindowTitle(WMWindow *win, char *title);
|
void WMSetWindowMiniwindowTitle(WMWindow *win, char *title);
|
||||||
|
|
||||||
|
void WMSetWindowMiniwindowImage(WMWindow *win, RImage *image);
|
||||||
|
|
||||||
void WMSetWindowMiniwindowPixmap(WMWindow *win, WMPixmap *pixmap);
|
void WMSetWindowMiniwindowPixmap(WMWindow *win, WMPixmap *pixmap);
|
||||||
|
|
||||||
void WMSetWindowCloseAction(WMWindow *win, WMAction *action, void *clientData);
|
void WMSetWindowCloseAction(WMWindow *win, WMAction *action, void *clientData);
|
||||||
|
|||||||
@@ -305,6 +305,12 @@ typedef struct W_Screen {
|
|||||||
Atom wmIconDragOffsetAtom;
|
Atom wmIconDragOffsetAtom;
|
||||||
|
|
||||||
Atom wmStateAtom; /* WM_STATE */
|
Atom wmStateAtom; /* WM_STATE */
|
||||||
|
|
||||||
|
Atom utf8String;
|
||||||
|
|
||||||
|
Atom netwmName;
|
||||||
|
Atom netwmIconName;
|
||||||
|
Atom netwmIcon;
|
||||||
|
|
||||||
/* stuff for detecting double-clicks */
|
/* stuff for detecting double-clicks */
|
||||||
Time lastClickTime; /* time of last mousedown event */
|
Time lastClickTime; /* time of last mousedown event */
|
||||||
|
|||||||
@@ -588,7 +588,11 @@ WMCreateScreenWithRContext(Display *display, int screen, RContext *context)
|
|||||||
"XdndActionAsk",
|
"XdndActionAsk",
|
||||||
"XdndActionPrivate",
|
"XdndActionPrivate",
|
||||||
"_WINGS_DND_MOUSE_OFFSET",
|
"_WINGS_DND_MOUSE_OFFSET",
|
||||||
"WM_STATE"
|
"WM_STATE",
|
||||||
|
"UTF8_STRING",
|
||||||
|
"_NET_WM_NAME",
|
||||||
|
"_NET_WM_ICON_NAME",
|
||||||
|
"_NET_WM_ICON",
|
||||||
};
|
};
|
||||||
Atom atoms[sizeof(atomNames)/sizeof(char*)];
|
Atom atoms[sizeof(atomNames)/sizeof(char*)];
|
||||||
int i;
|
int i;
|
||||||
@@ -901,12 +905,16 @@ WMCreateScreenWithRContext(Display *display, int screen, RContext *context)
|
|||||||
scrPtr->wmIconDragOffsetAtom = atoms[i++];
|
scrPtr->wmIconDragOffsetAtom = atoms[i++];
|
||||||
|
|
||||||
scrPtr->wmStateAtom = atoms[i++];
|
scrPtr->wmStateAtom = atoms[i++];
|
||||||
|
|
||||||
|
scrPtr->utf8String = atoms[i++];
|
||||||
|
scrPtr->netwmName = atoms[i++];
|
||||||
|
scrPtr->netwmIconName = atoms[i++];
|
||||||
|
scrPtr->netwmIcon = atoms[i++];
|
||||||
|
|
||||||
scrPtr->rootView = W_CreateRootView(scrPtr);
|
scrPtr->rootView = W_CreateRootView(scrPtr);
|
||||||
|
|
||||||
scrPtr->balloon = W_CreateBalloon(scrPtr);
|
scrPtr->balloon = W_CreateBalloon(scrPtr);
|
||||||
|
|
||||||
|
|
||||||
W_InitApplication(scrPtr);
|
W_InitApplication(scrPtr);
|
||||||
|
|
||||||
return scrPtr;
|
return scrPtr;
|
||||||
|
|||||||
133
WINGs/wwindow.c
133
WINGs/wwindow.c
@@ -199,12 +199,101 @@ WMCreateWindowWithStyle(WMScreen *screen, char *name, int style)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
WMSetWindowTitle(WMWindow *win, char *title)
|
static void
|
||||||
|
setWindowTitle(WMWindow *win, const char *title)
|
||||||
{
|
{
|
||||||
|
WMScreen *scr= win->view->screen;
|
||||||
XTextProperty property;
|
XTextProperty property;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
|
result = XmbTextListToTextProperty(scr->display,
|
||||||
|
(char**)&title, 1, XStdICCTextStyle,
|
||||||
|
&property);
|
||||||
|
if (result == XNoMemory || result == XLocaleNotSupported) {
|
||||||
|
wwarning("window title conversion error... using STRING encoding");
|
||||||
|
XStoreName(scr->display, win->view->window, title);
|
||||||
|
} else {
|
||||||
|
XSetWMName(scr->display, win->view->window, &property);
|
||||||
|
if (property.value)
|
||||||
|
XFree(property.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
XChangeProperty(scr->display, win->view->window,
|
||||||
|
scr->netwmName, scr->utf8String, 8,
|
||||||
|
PropModeReplace, (unsigned char *)title, strlen(title));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
setMiniwindowTitle(WMWindow *win, const char *title)
|
||||||
|
{
|
||||||
|
WMScreen *scr= win->view->screen;
|
||||||
|
XTextProperty property;
|
||||||
|
int result;
|
||||||
|
|
||||||
|
result = XmbTextListToTextProperty(scr->display,
|
||||||
|
(char**)&title, 1, XStdICCTextStyle,
|
||||||
|
&property);
|
||||||
|
if (result == XNoMemory || result == XLocaleNotSupported) {
|
||||||
|
wwarning("icon title conversion error..using STRING encoding");
|
||||||
|
XSetIconName(scr->display, win->view->window, title);
|
||||||
|
} else {
|
||||||
|
XSetWMIconName(scr->display, win->view->window, &property);
|
||||||
|
if (property.value)
|
||||||
|
XFree(property.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
XChangeProperty(scr->display, win->view->window,
|
||||||
|
scr->netwmIconName, scr->utf8String, 8,
|
||||||
|
PropModeReplace, (unsigned char *)title, strlen(title));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
setMiniwindow(WMWindow *win, RImage *image)
|
||||||
|
{
|
||||||
|
WMScreen *scr= win->view->screen;
|
||||||
|
CARD32 *data;
|
||||||
|
int x, y;
|
||||||
|
int o;
|
||||||
|
|
||||||
|
if (!image)
|
||||||
|
return;
|
||||||
|
|
||||||
|
data= malloc((image->width * image->height + 2) * sizeof(CARD32));
|
||||||
|
if (!data)
|
||||||
|
return;
|
||||||
|
|
||||||
|
o= 0;
|
||||||
|
data[o++] = image->width;
|
||||||
|
data[o++] = image->height;
|
||||||
|
|
||||||
|
for (y= 0; y < image->height; y++) {
|
||||||
|
for (x= 0; x < image->width; x++) {
|
||||||
|
CARD32 pixel;
|
||||||
|
int offs= (x+y*image->width);
|
||||||
|
|
||||||
|
if (image->format == RRGBFormat)
|
||||||
|
pixel= image->data[offs*3]<<16 | image->data[offs*3+1]<<8 | image->data[offs*3+2];
|
||||||
|
else
|
||||||
|
pixel= image->data[offs*4]<<16 | image->data[offs*4+1]<<8 | image->data[offs*4+2] | image->data[offs*4+3] << 24;
|
||||||
|
|
||||||
|
data[o++]= pixel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
XChangeProperty(scr->display, win->view->window,
|
||||||
|
scr->netwmIcon, XA_CARDINAL, 32,
|
||||||
|
PropModeReplace,
|
||||||
|
(unsigned char *)data,
|
||||||
|
(image->width * image->height + 2) * sizeof(CARD32));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
WMSetWindowTitle(WMWindow *win, char *title)
|
||||||
|
{
|
||||||
if (win->title!=NULL)
|
if (win->title!=NULL)
|
||||||
wfree(win->title);
|
wfree(win->title);
|
||||||
if (title!=NULL)
|
if (title!=NULL)
|
||||||
@@ -213,17 +302,7 @@ WMSetWindowTitle(WMWindow *win, char *title)
|
|||||||
win->title = NULL;
|
win->title = NULL;
|
||||||
|
|
||||||
if (win->view->flags.realized) {
|
if (win->view->flags.realized) {
|
||||||
result = XmbTextListToTextProperty (win->view->screen->display,
|
setWindowTitle(win, title);
|
||||||
&title, 1, XStdICCTextStyle,
|
|
||||||
&property);
|
|
||||||
if (result == XNoMemory || result == XLocaleNotSupported) {
|
|
||||||
wwarning("window title conversion error... using STRING encoding");
|
|
||||||
XStoreName(win->view->screen->display, win->view->window, title);
|
|
||||||
} else {
|
|
||||||
XSetWMName(win->view->screen->display, win->view->window, &property);
|
|
||||||
if (property.value)
|
|
||||||
XFree(property.value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -454,6 +533,9 @@ realizeWindow(WMWindow *win)
|
|||||||
XSetTransientForHint(scr->display, win->view->window,
|
XSetTransientForHint(scr->display, win->view->window,
|
||||||
win->owner->view->window);
|
win->owner->view->window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (win->title)
|
||||||
|
setWindowTitle(win, win->title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -563,6 +645,14 @@ WMSetWindowDocumentEdited(WMWindow *win, Bool flag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
WMSetWindowMiniwindowImage(WMWindow *win, RImage *image)
|
||||||
|
{
|
||||||
|
if (win->view->flags.realized)
|
||||||
|
setMiniwindow(win, image);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WMSetWindowMiniwindowPixmap(WMWindow *win, WMPixmap *pixmap)
|
WMSetWindowMiniwindowPixmap(WMWindow *win, WMPixmap *pixmap)
|
||||||
{
|
{
|
||||||
@@ -605,9 +695,6 @@ WMSetWindowMiniwindowPixmap(WMWindow *win, WMPixmap *pixmap)
|
|||||||
void
|
void
|
||||||
WMSetWindowMiniwindowTitle(WMWindow *win, char *title)
|
WMSetWindowMiniwindowTitle(WMWindow *win, char *title)
|
||||||
{
|
{
|
||||||
XTextProperty property;
|
|
||||||
int result;
|
|
||||||
|
|
||||||
if ((win->miniTitle && !title) || (!win->miniTitle && title)
|
if ((win->miniTitle && !title) || (!win->miniTitle && title)
|
||||||
|| (title && win->miniTitle && strcoll(title, win->miniTitle)!=0)) {
|
|| (title && win->miniTitle && strcoll(title, win->miniTitle)!=0)) {
|
||||||
if (win->miniTitle)
|
if (win->miniTitle)
|
||||||
@@ -619,19 +706,7 @@ WMSetWindowMiniwindowTitle(WMWindow *win, char *title)
|
|||||||
win->miniTitle = NULL;
|
win->miniTitle = NULL;
|
||||||
|
|
||||||
if (win->view->flags.realized) {
|
if (win->view->flags.realized) {
|
||||||
result = XmbTextListToTextProperty (win->view->screen->display,
|
setMiniwindowTitle(win, title);
|
||||||
&title, 1, XStdICCTextStyle,
|
|
||||||
&property);
|
|
||||||
if (result == XNoMemory || result == XLocaleNotSupported) {
|
|
||||||
wwarning("icon title conversion error..using STRING encoding");
|
|
||||||
XSetIconName(win->view->screen->display, win->view->window,
|
|
||||||
title);
|
|
||||||
} else {
|
|
||||||
XSetWMIconName(win->view->screen->display, win->view->window,
|
|
||||||
&property);
|
|
||||||
if (property.value)
|
|
||||||
XFree(property.value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -262,7 +262,6 @@ createMainWindow(WMScreen *scr)
|
|||||||
WMSetWindowMaxSize(WPrefs.win, 520, 390);
|
WMSetWindowMaxSize(WPrefs.win, 520, 390);
|
||||||
WMSetWindowMinSize(WPrefs.win, 520, 390);
|
WMSetWindowMinSize(WPrefs.win, 520, 390);
|
||||||
WMSetWindowMiniwindowTitle(WPrefs.win, "Preferences");
|
WMSetWindowMiniwindowTitle(WPrefs.win, "Preferences");
|
||||||
WMSetWindowMiniwindowPixmap(WPrefs.win, WMGetApplicationIconPixmap(scr));
|
|
||||||
|
|
||||||
WPrefs.scrollV = WMCreateScrollView(WPrefs.win);
|
WPrefs.scrollV = WMCreateScrollView(WPrefs.win);
|
||||||
WMResizeWidget(WPrefs.scrollV, 500, 87);
|
WMResizeWidget(WPrefs.scrollV, 500, 87);
|
||||||
@@ -636,8 +635,6 @@ Initialize(WMScreen *scr)
|
|||||||
char **list;
|
char **list;
|
||||||
int i;
|
int i;
|
||||||
char *path;
|
char *path;
|
||||||
WMPixmap *icon;
|
|
||||||
|
|
||||||
|
|
||||||
list = RSupportedFileFormats();
|
list = RSupportedFileFormats();
|
||||||
for (i=0; list[i]!=NULL; i++) {
|
for (i=0; list[i]!=NULL; i++) {
|
||||||
@@ -659,12 +656,8 @@ Initialize(WMScreen *scr)
|
|||||||
wwarning(_("could not load image file %s:%s"), path,
|
wwarning(_("could not load image file %s:%s"), path,
|
||||||
RMessageForError(RErrorCode));
|
RMessageForError(RErrorCode));
|
||||||
} else {
|
} else {
|
||||||
icon = WMCreatePixmapFromRImage(scr, tmp, 0);
|
WMSetApplicationIconImage(scr, tmp);
|
||||||
RReleaseImage(tmp);
|
RReleaseImage(tmp);
|
||||||
if (icon) {
|
|
||||||
WMSetApplicationIconPixmap(scr, icon);
|
|
||||||
WMReleasePixmap(icon);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
wfree(path);
|
wfree(path);
|
||||||
}
|
}
|
||||||
@@ -673,6 +666,9 @@ Initialize(WMScreen *scr)
|
|||||||
createMainWindow(scr);
|
createMainWindow(scr);
|
||||||
|
|
||||||
WMRealizeWidget(WPrefs.win);
|
WMRealizeWidget(WPrefs.win);
|
||||||
|
|
||||||
|
WMSetWindowMiniwindowImage(WPrefs.win, WMGetApplicationIconImage(scr));
|
||||||
|
|
||||||
WMMapWidget(WPrefs.win);
|
WMMapWidget(WPrefs.win);
|
||||||
XFlush(WMScreenDisplay(scr));
|
XFlush(WMScreenDisplay(scr));
|
||||||
WMSetLabelText(WPrefs.statusL, _("Loading Window Maker configuration files..."));
|
WMSetLabelText(WPrefs.statusL, _("Loading Window Maker configuration files..."));
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
|
|||||||
Bool somethingElse = False;
|
Bool somethingElse = False;
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
WSwitchPanel *swpanel = NULL;
|
WSwitchPanel *swpanel = NULL;
|
||||||
KeyCode leftKey, rightKey, homeKey, endKey;
|
KeyCode leftKey, rightKey, homeKey, endKey, shiftLKey, shiftRKey;
|
||||||
|
|
||||||
if (!wwin)
|
if (!wwin)
|
||||||
return;
|
return;
|
||||||
@@ -81,6 +81,8 @@ StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
|
|||||||
rightKey = XKeysymToKeycode(dpy, XK_Right);
|
rightKey = XKeysymToKeycode(dpy, XK_Right);
|
||||||
homeKey = XKeysymToKeycode(dpy, XK_Home);
|
homeKey = XKeysymToKeycode(dpy, XK_Home);
|
||||||
endKey = XKeysymToKeycode(dpy, XK_End);
|
endKey = XKeysymToKeycode(dpy, XK_End);
|
||||||
|
shiftLKey = XKeysymToKeycode(dpy, XK_Shift_L);
|
||||||
|
shiftRKey = XKeysymToKeycode(dpy, XK_Shift_R);
|
||||||
|
|
||||||
if (next)
|
if (next)
|
||||||
hasModifier = (wKeyBindings[WKBD_FOCUSNEXT].modifier != 0);
|
hasModifier = (wKeyBindings[WKBD_FOCUSNEXT].modifier != 0);
|
||||||
@@ -179,7 +181,7 @@ StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else if (ev.xkey.keycode != shiftLKey && ev.xkey.keycode != shiftRKey) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("Got something else\n");
|
printf("Got something else\n");
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -317,7 +317,7 @@ WSwitchPanel *wInitSwitchPanel(WScreen *scr, WWindow *curwin, int workspace)
|
|||||||
WMColor *color;
|
WMColor *color;
|
||||||
WMFont *boldFont= WMBoldSystemFontOfSize(scr->wmscreen, 12);
|
WMFont *boldFont= WMBoldSystemFontOfSize(scr->wmscreen, 12);
|
||||||
|
|
||||||
WMSetLabelRelief(panel->label, WRSunken);
|
WMSetLabelRelief(panel->label, WRSimple);
|
||||||
WMSetLabelFont(panel->label, boldFont);
|
WMSetLabelFont(panel->label, boldFont);
|
||||||
color = WMDarkGrayColor(scr->wmscreen);
|
color = WMDarkGrayColor(scr->wmscreen);
|
||||||
WMSetWidgetBackgroundColor(panel->label, color);
|
WMSetWidgetBackgroundColor(panel->label, color);
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ wmsetup_LDADD = \
|
|||||||
wmsetbg_LDADD = \
|
wmsetbg_LDADD = \
|
||||||
$(top_builddir)/WINGs/libWINGs.a \
|
$(top_builddir)/WINGs/libWINGs.a \
|
||||||
$(top_builddir)/wrlib/libwraster.la \
|
$(top_builddir)/wrlib/libwraster.la \
|
||||||
@XFTLIBS@ @INTLIBS@ @DLLIBS@
|
@XLIBS@ @XFTLIBS@ @INTLIBS@ @DLLIBS@
|
||||||
|
|
||||||
CLEANFILES = wmaker.inst
|
CLEANFILES = wmaker.inst
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user