Rewrap more X stuff.

SVN revision: 34149
This commit is contained in:
Kim Woelders 2008-03-30 12:13:16 +00:00
parent 02f2b0d882
commit b780491887
33 changed files with 236 additions and 140 deletions

View File

@ -65,7 +65,7 @@
#define USE_GLX 1
#endif
#include "xwin.h"
#include "xtypes.h"
#define ENABLE_COLOR_MODIFIERS 0 /* Not functional */
#define ENABLE_DESKRAY 0 /* Not functional */

View File

@ -106,6 +106,7 @@ e16_SOURCES = \
warp.c \
windowmatch.c windowmatch.h \
x.c xwin.h \
xtypes.h \
zoom.c \
$(MODULE_SRCS) \
$(SRCS_GNOME) \

View File

@ -99,7 +99,7 @@ ActionCreate(char event, char anymod, int mod, int anybut, int but,
if (!key || !key[0] || (event != EVENT_KEY_DOWN && event != EVENT_KEY_UP))
aa->key = 0;
else
aa->key = XKeysymToKeycode(disp, XStringToKeysym(key));
aa->key = EKeynameToKeycode(key);
aa->key_str = (aa->key) ? Estrdup(key) : NULL;
aa->tooltipstring =
(tooltipstring) ? Estrdup((tooltipstring[0]) ? tooltipstring : "?!?") :
@ -1242,9 +1242,9 @@ IPC_KeybindingsGet(const char *params __UNUSED__)
aa = ac->list[i];
if ((aa) && (aa->action) && (aa->event == EVENT_KEY_DOWN))
{
char *key;
const char *key;
key = XKeysymToString(XKeycodeToKeysym(disp, aa->key, 0));
key = EKeycodeToString(aa->key, 0);
if (!key)
continue;

View File

@ -27,6 +27,7 @@
#include <string.h>
#include <unistd.h>
#include <X11/Xlib.h>
#include <X11/keysym.h>
#include "alert.h"
#include "lang.h"
#include "session.h"
@ -382,7 +383,7 @@ ShowAlert(const char *title,
switch (ev.type)
{
case KeyPress:
key = XKeysymToKeycode(dd, XStringToKeysym("F1"));
key = XKeysymToKeycode(dd, XK_F1);
if (key == ev.xkey.keycode)
{
DRAW_BOX_IN(dd, gc, b1, 0, 0, mh + 10, fh + 10);
@ -392,7 +393,7 @@ ShowAlert(const char *title,
button = 1;
break;
}
key = XKeysymToKeycode(dd, XStringToKeysym("F2"));
key = XKeysymToKeycode(dd, XK_F2);
if (key == ev.xkey.keycode)
{
DRAW_BOX_IN(dd, gc, b2, 0, 0, mh + 10, fh + 10);
@ -402,7 +403,7 @@ ShowAlert(const char *title,
button = 2;
break;
}
key = XKeysymToKeycode(dd, XStringToKeysym("F3"));
key = XKeysymToKeycode(dd, XK_F3);
if (key == ev.xkey.keycode)
{
DRAW_BOX_IN(dd, gc, b3, 0, 0, mh + 10, fh + 10);

View File

@ -558,7 +558,7 @@ EwinBorderSetTo(EWin * ewin, const Border * b)
if (!b->part[i].ontop)
wl[j++] = WinGetXwin(ewin->bits[i].win);
}
XRestackWindows(disp, wl, j);
EXRestackWindows(wl, j);
Efree(wl);
}

View File

@ -494,7 +494,7 @@ ButtonEventMouseDown(Button * b, XEvent * ev)
Window win = ev->xbutton.window;
ev->xbutton.window = b->inside_win;
XSendEvent(disp, b->inside_win, False, ButtonPressMask, ev);
EXSendEvent(b->inside_win, ButtonPressMask, ev);
ev->xbutton.window = win;
}
@ -522,7 +522,7 @@ ButtonEventMouseUp(Button * b, XEvent * ev)
Window win = ev->xbutton.window;
ev->xbutton.window = b->inside_win;
XSendEvent(disp, b->inside_win, False, ButtonReleaseMask, ev);
EXSendEvent(b->inside_win, ButtonReleaseMask, ev);
ev->xbutton.window = win;
}

View File

@ -327,7 +327,7 @@ CommsDoSend(Window win, const char *s)
ss[20] = 0;
for (k = 0; k < 20; k++)
ev.xclient.data.b[k] = ss[k];
XSendEvent(disp, win, False, 0, (XEvent *) & ev);
EXSendEvent(win, 0, (XEvent *) & ev);
}
}

View File

@ -1439,7 +1439,7 @@ DeskRestack(Desk * dsk)
EXWindowGetParent(wl[i]));
}
XRestackWindows(disp, wl, tot);
EXRestackWindows(wl, tot);
Efree(wl);
@ -1737,8 +1737,7 @@ static void
ButtonProxySendEvent(XEvent * ev)
{
if (Mode.button_proxy_win)
XSendEvent(disp, Mode.button_proxy_win, False, SubstructureNotifyMask,
ev);
EXSendEvent(Mode.button_proxy_win, SubstructureNotifyMask, ev);
}
static void

View File

@ -213,8 +213,7 @@ DialogBindKey(Dialog * d, const char *key, DialogCallbackFunc * func, int val,
d->keybindings[d->num_bindings - 1].val = val;
d->keybindings[d->num_bindings - 1].func = func;
d->keybindings[d->num_bindings - 1].data = data;
d->keybindings[d->num_bindings - 1].key =
XKeysymToKeycode(disp, XStringToKeysym(key));
d->keybindings[d->num_bindings - 1].key = EKeynameToKeycode(key);
}
void
@ -1734,8 +1733,7 @@ DialogUpdate(Dialog * d)
if (d->item)
DialogDrawItem(d, d->item);
if (d->xu1 < d->xu2 && d->yu1 < d->yu2)
EClearArea(d->win, d->xu1, d->yu1, d->xu2 - d->xu1, d->yu2 - d->yu1,
False);
EClearArea(d->win, d->xu1, d->yu1, d->xu2 - d->xu1, d->yu2 - d->yu1);
d->update = 0;
d->xu1 = d->yu1 = 99999;
d->xu2 = d->yu2 = 0;

View File

@ -28,27 +28,17 @@
#include <X11/extensions/Xrender.h>
#endif
static Window _default_draw;
static Visual *_default_vis;
static Colormap _default_cmap;
void
EImageInit(void)
{
Display *dpy = disp;
imlib_set_cache_size(2048 * 1024);
imlib_set_font_cache_size(512 * 1024);
imlib_set_color_usage(128);
_default_draw = DefaultRootWindow(dpy);
_default_vis = DefaultVisual(dpy, DefaultScreen(dpy));
_default_cmap = DefaultColormap(dpy, DefaultScreen(dpy));
imlib_context_set_display(dpy);
imlib_context_set_visual(_default_vis);
imlib_context_set_colormap(_default_cmap);
imlib_context_set_display(disp);
imlib_context_set_visual(WinGetVisual(VROOT));
imlib_context_set_colormap(WinGetCmap(VROOT));
#ifdef HAVE_IMLIB_CONTEXT_SET_MASK_ALPHA_THRESHOLD
imlib_context_set_mask_alpha_threshold(Conf.testing.mask_alpha_threshold);
@ -402,7 +392,7 @@ EImageGrabDrawableScaled(Win win, Drawable draw, Pixmap mask,
get_mask_from_shape);
if (vis)
imlib_context_set_visual(_default_vis);
imlib_context_set_visual(WinGetVisual(VROOT));
return im;
}
@ -426,7 +416,7 @@ EImageRenderOnDrawable(EImage * im, Win win, Drawable draw, int flags,
_EImageFlagsReset();
if (vis)
imlib_context_set_visual(_default_vis);
imlib_context_set_visual(WinGetVisual(VROOT));
}
void
@ -437,7 +427,7 @@ EImageRenderPixmaps(EImage * im, Win win, int flags,
Pixmap m;
imlib_context_set_image(im);
imlib_context_set_drawable((win) ? WinGetXwin(win) : _default_draw);
imlib_context_set_drawable((win) ? WinGetXwin(win) : WinGetXwin(VROOT));
vis = (win) ? WinGetVisual(win) : NULL;
if (vis)
imlib_context_set_visual(vis);
@ -458,7 +448,7 @@ EImageRenderPixmaps(EImage * im, Win win, int flags,
_EImageFlagsReset();
if (vis)
imlib_context_set_visual(_default_vis);
imlib_context_set_visual(WinGetVisual(VROOT));
}
void

View File

@ -24,7 +24,7 @@
#define _EIMAGE_H_
#include <X11/X.h>
#include "xwin.h"
#include "xtypes.h"
typedef void EImage;
typedef void EImageColorModifier;

View File

@ -313,7 +313,7 @@ HandleEvent(XEvent * ev)
CurrentTime);
ESync();
ev->xkey.time = CurrentTime;
XSendEvent(disp, ev->xkey.root, False, 0, ev);
EXSendEvent(ev->xkey.root, 0, ev);
return;
}
#endif

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2006-2007 Kim Woelders
* Copyright (C) 2006-2008 Kim Woelders
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -23,6 +23,8 @@
#ifndef _EVENTS_H_
#define _EVENTS_H_
#include <X11/Xlib.h>
/* Re-mapped X-events */
#define EX_EVENT_CREATE_GONE 64
#define EX_EVENT_UNMAP_GONE 65

View File

@ -72,7 +72,7 @@ ExtInitWinMain(void)
XFreePixmap(disp, pmap);
XFreeGC(disp, gc);
a = XInternAtom(disp, "ENLIGHTENMENT_RESTART_SCREEN", False);
a = EInternAtom("ENLIGHTENMENT_RESTART_SCREEN");
ecore_x_window_prop_window_set(WinGetXwin(VROOT), a, &win, 1);
XSelectInput(disp, win, StructureNotifyMask);
@ -160,7 +160,7 @@ ExtInitWinCreate(void)
if (EDebug(EDBUG_TYPE_SESSION))
Eprintf("ExtInitWinCreate\n");
a = XInternAtom(disp, "ENLIGHTENMENT_RESTART_SCREEN", False);
a = EInternAtom("ENLIGHTENMENT_RESTART_SCREEN");
ESync(0);
if (fork())

View File

@ -139,7 +139,7 @@ FX_Ripple_Quit(void)
{
RemoveTimerEvent("FX_RIPPLE_TIMEOUT");
EClearArea(fx_ripple_win, 0, WinGetH(VROOT) - fx_ripple_waterh,
WinGetW(VROOT), fx_ripple_waterh, False);
WinGetW(VROOT), fx_ripple_waterh);
}
static void
@ -579,7 +579,7 @@ FX_Waves_Quit(void)
{
RemoveTimerEvent("FX_WAVE_TIMEOUT");
EClearArea(fx_wave_win, 0, WinGetH(VROOT) - FX_WAVE_WATERH,
WinGetW(VROOT), FX_WAVE_WATERH, False);
WinGetW(VROOT), FX_WAVE_WATERH);
}
static void

View File

@ -249,7 +249,7 @@
*
* xev.type = ClientMessage;
* xev.window = client_window;
* xev.message_type = XInternAtom(disp, XA_WIN_LAYER, False);
* xev.message_type = EInternAtom(XA_WIN_LAYER);
* xev.format = 32;
* xev.data.l[0] = new_layer;
* xev.data.l[1] = CurrentTime;
@ -263,7 +263,7 @@
*
* xev.type = ClientMessage;
* xev.window = client_window;
* xev.message_type = XInternAtom(disp, XA_WIN_STATE, False);
* xev.message_type = EInternAtom(XA_WIN_STATE);
* xev.format = 32;
* xev.data.l[0] = mask_of_members_to_change;
* xev.data.l[1] = new_members;
@ -278,7 +278,7 @@
*
* xev.type = ClientMessage;
* xev.window = client_window;
* xev.message_type = XInternAtom(disp, XA_WIN_WORKSPACE, False);
* xev.message_type = EInternAtom(XA_WIN_WORKSPACE);
* xev.format = 32;
* xev.data.l[0] = new_desktop_number;
* xev.data.l[2] = CurrentTimep;
@ -299,7 +299,7 @@ GNOME_GetHintIcons(EWin * ewin, Atom atom_change)
return;
if (!atom_get)
atom_get = XInternAtom(disp, XA_WIN_ICONS, False);
atom_get = EInternAtom(XA_WIN_ICONS);
if ((atom_change) && (atom_change != atom_get))
return;
@ -328,7 +328,7 @@ GNOME_GetHintLayer(EWin * ewin, Atom atom_change)
return;
if (!atom_get)
atom_get = XInternAtom(disp, XA_WIN_LAYER, False);
atom_get = EInternAtom(XA_WIN_LAYER);
if ((atom_change) && (atom_change != atom_get))
return;
@ -352,7 +352,7 @@ GNOME_GetHintState(EWin * ewin, Atom atom_change)
return;
if (!atom_get)
atom_get = XInternAtom(disp, XA_WIN_STATE, False);
atom_get = EInternAtom(XA_WIN_STATE);
if ((atom_change) && (atom_change != atom_get))
return;
@ -385,7 +385,7 @@ GNOME_GetHintAppState(EWin * ewin, Atom atom_change)
return;
if (!atom_get)
atom_get = XInternAtom(disp, XA_WIN_APP_STATE, False);
atom_get = EInternAtom(XA_WIN_APP_STATE);
if ((atom_change) && (atom_change != atom_get))
return;
@ -407,7 +407,7 @@ GNOME_GetHintDesktop(EWin * ewin, Atom atom_change)
return;
if (!atom_get)
atom_get = XInternAtom(disp, XA_WIN_WORKSPACE, False);
atom_get = EInternAtom(XA_WIN_WORKSPACE);
if ((atom_change) && (atom_change != atom_get))
return;
@ -431,7 +431,7 @@ GNOME_GetHint(EWin * ewin, Atom atom_change)
return;
if (!atom_get)
atom_get = XInternAtom(disp, XA_WIN_HINTS, False);
atom_get = EInternAtom(XA_WIN_HINTS);
if ((atom_change) && (atom_change != atom_get))
return;
@ -461,7 +461,7 @@ GNOME_SetHint(const EWin * ewin)
if ((ewin->type == EWIN_TYPE_MENU) || (ewin->type == EWIN_TYPE_PAGER))
return;
if (!atom_set)
atom_set = XInternAtom(disp, XA_WIN_STATE, False);
atom_set = EInternAtom(XA_WIN_STATE);
val = 0;
if (EoIsSticky(ewin))
val |= WIN_STATE_STICKY;
@ -481,7 +481,7 @@ GNOME_SetEwinArea(const EWin * ewin)
if ((ewin->type == EWIN_TYPE_MENU) || (ewin->type == EWIN_TYPE_PAGER))
return;
if (!atom_set)
atom_set = XInternAtom(disp, XA_WIN_AREA, False);
atom_set = EInternAtom(XA_WIN_AREA);
val[0] = ewin->area_x;
val[1] = ewin->area_y;
ecore_x_window_prop_card32_set(EwinGetClientXwin(ewin), atom_set, val, 2);
@ -496,7 +496,7 @@ GNOME_SetEwinDesk(const EWin * ewin)
if ((ewin->type == EWIN_TYPE_MENU) || (ewin->type == EWIN_TYPE_PAGER))
return;
if (!atom_set)
atom_set = XInternAtom(disp, XA_WIN_WORKSPACE, False);
atom_set = EInternAtom(XA_WIN_WORKSPACE);
val = EoGetDeskNum(ewin);
ecore_x_window_prop_card32_set(EwinGetClientXwin(ewin), atom_set, &val, 1);
}
@ -513,7 +513,7 @@ GNOME_GetExpandedSize(EWin * ewin, Atom atom_change)
return;
if (!atom_get)
atom_get = XInternAtom(disp, XA_WIN_EXPANDED_SIZE, False);
atom_get = EInternAtom(XA_WIN_EXPANDED_SIZE);
if ((atom_change) && (atom_change != atom_get))
return;
@ -538,17 +538,17 @@ GNOME_SetUsedHints(void)
Ecore_X_Atom list[10];
if (!atom_set)
atom_set = XInternAtom(disp, XA_WIN_PROTOCOLS, False);
list[0] = XInternAtom(disp, XA_WIN_LAYER, False);
list[1] = XInternAtom(disp, XA_WIN_STATE, False);
list[2] = XInternAtom(disp, XA_WIN_HINTS, False);
list[3] = XInternAtom(disp, XA_WIN_APP_STATE, False);
list[4] = XInternAtom(disp, XA_WIN_EXPANDED_SIZE, False);
list[5] = XInternAtom(disp, XA_WIN_ICONS, False);
list[6] = XInternAtom(disp, XA_WIN_WORKSPACE, False);
list[7] = XInternAtom(disp, XA_WIN_WORKSPACE_COUNT, False);
list[8] = XInternAtom(disp, XA_WIN_WORKSPACE_NAMES, False);
list[9] = XInternAtom(disp, XA_WIN_CLIENT_LIST, False);
atom_set = EInternAtom(XA_WIN_PROTOCOLS);
list[0] = EInternAtom(XA_WIN_LAYER);
list[1] = EInternAtom(XA_WIN_STATE);
list[2] = EInternAtom(XA_WIN_HINTS);
list[3] = EInternAtom(XA_WIN_APP_STATE);
list[4] = EInternAtom(XA_WIN_EXPANDED_SIZE);
list[5] = EInternAtom(XA_WIN_ICONS);
list[6] = EInternAtom(XA_WIN_WORKSPACE);
list[7] = EInternAtom(XA_WIN_WORKSPACE_COUNT);
list[8] = EInternAtom(XA_WIN_WORKSPACE_NAMES);
list[9] = EInternAtom(XA_WIN_CLIENT_LIST);
ecore_x_window_prop_atom_set(WinGetXwin(VROOT), atom_set, list, 10);
}
@ -560,7 +560,7 @@ GNOME_SetCurrentArea(void)
int ax, ay;
if (!atom_set)
atom_set = XInternAtom(disp, XA_WIN_AREA, False);
atom_set = EInternAtom(XA_WIN_AREA);
DeskCurrentGetArea(&ax, &ay);
val[0] = ax;
val[1] = ay;
@ -574,7 +574,7 @@ GNOME_SetCurrentDesk(void)
unsigned int val;
if (!atom_set)
atom_set = XInternAtom(disp, XA_WIN_WORKSPACE, False);
atom_set = EInternAtom(XA_WIN_WORKSPACE);
val = DesksGetCurrentNum();
ecore_x_window_prop_card32_set(WinGetXwin(VROOT), atom_set, &val, 1);
}
@ -586,7 +586,7 @@ GNOME_SetWMCheck(Window win_wm_check)
unsigned int val;
if (!atom_set)
atom_set = XInternAtom(disp, XA_WIN_SUPPORTING_WM_CHECK, False);
atom_set = EInternAtom(XA_WIN_SUPPORTING_WM_CHECK);
val = win_wm_check;
ecore_x_window_prop_card32_set(WinGetXwin(VROOT), atom_set, &val, 1);
ecore_x_window_prop_card32_set(win_wm_check, atom_set, &val, 1);
@ -599,7 +599,7 @@ GNOME_SetDeskCount(void)
unsigned int val;
if (!atom_set)
atom_set = XInternAtom(disp, XA_WIN_WORKSPACE_COUNT, False);
atom_set = EInternAtom(XA_WIN_WORKSPACE_COUNT);
val = DesksGetNumber();
ecore_x_window_prop_card32_set(WinGetXwin(VROOT), atom_set, &val, 1);
}
@ -612,7 +612,7 @@ GNOME_SetAreaCount(void)
unsigned int val[2];
if (!atom_set)
atom_set = XInternAtom(disp, XA_WIN_AREA_COUNT, False);
atom_set = EInternAtom(XA_WIN_AREA_COUNT);
DesksGetAreaSize(&ax, &ay);
val[0] = ax;
val[1] = ay;
@ -627,7 +627,7 @@ GNOME_SetDeskNames(void)
int i, n_desks;
if (!atom_set)
atom_set = XInternAtom(disp, XA_WIN_WORKSPACE_NAMES, False);
atom_set = EInternAtom(XA_WIN_WORKSPACE_NAMES);
n_desks = DesksGetNumber();
names = EMALLOC(char *, n_desks);
@ -658,7 +658,7 @@ GNOME_SetClientList(void)
EWin *const *lst;
if (!atom_set)
atom_set = XInternAtom(disp, XA_WIN_CLIENT_LIST, False);
atom_set = EInternAtom(XA_WIN_CLIENT_LIST);
lst = EwinListOrderGet(&num);
wl = NULL;
@ -683,11 +683,11 @@ GNOME_SetWMNameVer(void)
static Atom atom_set = 0, atom_set2 = 0;
if (!atom_set)
atom_set = XInternAtom(disp, XA_WIN_WM_NAME, False);
atom_set = EInternAtom(XA_WIN_WM_NAME);
ecore_x_window_prop_string_set(WinGetXwin(VROOT), atom_set, e_wm_name);
if (!atom_set2)
atom_set2 = XInternAtom(disp, XA_WIN_WM_VERSION, False);
atom_set2 = EInternAtom(XA_WIN_WM_VERSION);
ecore_x_window_prop_string_set(WinGetXwin(VROOT), atom_set2, e_wm_version);
}
@ -699,12 +699,12 @@ GNOME_DelHints(const EWin * ewin)
if (!atom_get[0])
{
atom_get[0] = XInternAtom(disp, XA_WIN_WORKSPACE, False);
atom_get[1] = XInternAtom(disp, XA_WIN_LAYER, False);
atom_get[2] = XInternAtom(disp, XA_WIN_STATE, False);
atom_get[3] = XInternAtom(disp, XA_WIN_HINTS, False);
atom_get[4] = XInternAtom(disp, XA_WIN_APP_STATE, False);
atom_get[5] = XInternAtom(disp, XA_WIN_AREA, False);
atom_get[0] = EInternAtom(XA_WIN_WORKSPACE);
atom_get[1] = EInternAtom(XA_WIN_LAYER);
atom_get[2] = EInternAtom(XA_WIN_STATE);
atom_get[3] = EInternAtom(XA_WIN_HINTS);
atom_get[4] = EInternAtom(XA_WIN_APP_STATE);
atom_get[5] = EInternAtom(XA_WIN_AREA);
}
win = EwinGetClientXwin(ewin);
@ -740,7 +740,7 @@ GNOME_SetHints(Window win_wm_check)
Atom atom_set;
unsigned int val;
atom_set = XInternAtom(disp, "_WIN_DESKTOP_BUTTON_PROXY", False);
atom_set = EInternAtom("_WIN_DESKTOP_BUTTON_PROXY");
Mode.button_proxy_win =
XCreateSimpleWindow(disp, WinGetXwin(VROOT), -80, -80, 24, 24, 0,
0, 0);
@ -756,9 +756,9 @@ GNOME_ProcessClientClientMessage(EWin * ewin, XClientMessageEvent * event)
static Atom a4 = 0, a5 = 0;
if (!a4)
a4 = XInternAtom(disp, "_WIN_LAYER", False);
a4 = EInternAtom("_WIN_LAYER");
if (!a5)
a5 = XInternAtom(disp, "_WIN_STATE", False);
a5 = EInternAtom("_WIN_STATE");
if (event->message_type == a4)
{
@ -810,9 +810,9 @@ GNOME_ProcessRootClientMessage(XClientMessageEvent * event)
static Atom a2 = 0, a3 = 0;
if (!a2)
a2 = XInternAtom(disp, "_WIN_AREA", False);
a2 = EInternAtom("_WIN_AREA");
if (!a3)
a3 = XInternAtom(disp, "_WIN_WORKSPACE", False);
a3 = EInternAtom("_WIN_WORKSPACE");
if (event->message_type == a2)
{

View File

@ -24,6 +24,7 @@
#include "E.h"
#include "cursors.h"
#include "grabs.h"
#include "xwin.h"
int
GrabKeyboardSet(Win win)

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2006-2007 Kim Woelders
* Copyright (C) 2006-2008 Kim Woelders
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -24,7 +24,7 @@
#ifndef _GRABS_H_
#define _GRABS_H_
#include "xwin.h"
#include "xtypes.h"
int GrabKeyboardSet(Win win);
int GrabKeyboardRelease(void);

View File

@ -588,7 +588,7 @@ SelectionAcquire(const char *name, EventCallbackFunc * func, void *data)
Esnprintf(buf, sizeof(buf), "%s%d", name, Dpy.screen);
sel->atom = XInternAtom(disp, buf, False);
sel->atom = EInternAtom(buf);
sel->time = EGetTimestamp();
sel->win = ECreateEventWindow(VROOT, -100, -100, 1, 1);

View File

@ -291,7 +291,7 @@ ICCCM_Configure(EWin * ewin)
ev.xconfigure.border_width = 0;
ev.xconfigure.above = EoGetXwin(ewin);
ev.xconfigure.override_redirect = False;
XSendEvent(disp, EwinGetClientXwin(ewin), False, StructureNotifyMask, &ev);
EXSendEvent(EwinGetClientXwin(ewin), StructureNotifyMask, &ev);
}
void

View File

@ -840,24 +840,24 @@ pt_type_to_flags(int image_type)
}
static EImage *
pt_get_bg_image(Window win, int w, int h, int use_root)
pt_get_bg_image(Win win, int w, int h, int use_root)
{
EImage *ii = NULL;
Window cr, dummy;
Win cr;
Drawable bg;
int xx, yy;
bg = DeskGetBackgroundPixmap(DesksGetCurrent());
if (use_root || bg == None)
{
cr = WinGetXwin(VROOT);
cr = VROOT;
bg = WinGetXwin(VROOT);
}
else
{
cr = EoGetXwin(DesksGetCurrent());
cr = EoGetWin(DesksGetCurrent());
}
XTranslateCoordinates(disp, win, cr, 0, 0, &xx, &yy, &dummy);
ETranslateCoordinates(win, cr, 0, 0, &xx, &yy, NULL);
#if 0
Eprintf("pt_get_bg_image %#lx %d %d %d %d\n", win, xx, yy, w, h);
#endif
@ -890,7 +890,7 @@ ImageclassGetImageBlended(ImageClass * ic, Win win, int w, int h, int active,
flags = pt_type_to_flags(image_type);
if (flags != ICLASS_ATTR_OPAQUE)
{
bg = pt_get_bg_image(WinGetXwin(win), w, h, flags & ICLASS_ATTR_GLASS);
bg = pt_get_bg_image(win, w, h, flags & ICLASS_ATTR_GLASS);
if (bg)
{
EImageBlendCM(bg, im, (flags & ICLASS_ATTR_USE_CM) ? icm : NULL);
@ -932,7 +932,7 @@ ImagestateMakePmapMask(ImageState * is, Win win, PmapMask * pmm,
if (flags != ICLASS_ATTR_OPAQUE)
{
ii = pt_get_bg_image(WinGetXwin(win), w, h, flags & ICLASS_ATTR_GLASS);
ii = pt_get_bg_image(win, w, h, flags & ICLASS_ATTR_GLASS);
}
else
{

View File

@ -1375,12 +1375,12 @@ IPC_InsertKeys(const char *params, Client * c __UNUSED__)
continue;
i += strlen(ks[j].ch) - 1;
ev.keycode = XKeysymToKeycode(disp, XStringToKeysym(ks[j].sym));
ev.keycode = EKeynameToKeycode(ks[j].sym);
ev.state = ks[j].state;
ev.type = KeyPress;
XSendEvent(disp, win, False, 0, (XEvent *) & ev);
EXSendEvent(win, 0, (XEvent *) & ev);
ev.type = KeyRelease;
XSendEvent(disp, win, False, 0, (XEvent *) & ev);
EXSendEvent(win, 0, (XEvent *) & ev);
break;
}
}

View File

@ -24,6 +24,7 @@
#include "E.h"
#include "emodule.h"
#include "lang.h"
#include <X11/Xlib.h>
#ifdef HAVE_LOCALE_H
#include <locale.h>

View File

@ -322,7 +322,7 @@ EExit(int exitcode)
/* XSetInputFocus(disp, None, RevertToParent, CurrentTime); */
/* I think this is a better way to release the grabs: (felix) */
XSetInputFocus(disp, PointerRoot, RevertToPointerRoot, CurrentTime);
XSelectInput(disp, WinGetXwin(VROOT), 0);
ESelectInput(VROOT, 0);
EDisplayClose();
}

View File

@ -80,7 +80,7 @@ MWM_GetHints(EWin * ewin, Atom atom_change)
return;
if (!_MOTIF_WM_HINTS)
_MOTIF_WM_HINTS = XInternAtom(disp, "_MOTIF_WM_HINTS", False);
_MOTIF_WM_HINTS = EInternAtom("_MOTIF_WM_HINTS");
if (atom_change && atom_change != _MOTIF_WM_HINTS)
return;
@ -183,7 +183,7 @@ MWM_SetInfo(void)
Window win;
} mwminfo;
a1 = XInternAtom(disp, "_MOTIF_WM_INFO", False);
a1 = EInternAtom("_MOTIF_WM_INFO");
mwminfo.flags = 2;
mwminfo.win = WinGetXwin(VROOT);
XChangeProperty(disp, WinGetXwin(VROOT), a1, a1, 32, PropModeReplace,

View File

@ -238,7 +238,7 @@ PagerScanTimeout(int val __UNUSED__, void *data)
ScaleRect(VROOT, WinGetXwin(VROOT), p->win, WinGetPmap(p->win), 0,
y2, WinGetW(VROOT), WinGetH(VROOT) / hh, xx, yy + y, ww, 1, HIQ);
EClearArea(p->win, xx, yy + y, ww, 1, False);
EClearArea(p->win, xx, yy + y, ww, 1);
y2 = p->h;
#else
y = ((phase & 0xfffffff8) + offsets[phase % 8]) % ww;
@ -246,7 +246,7 @@ PagerScanTimeout(int val __UNUSED__, void *data)
ScaleRect(VROOT, WinGetXwin(VROOT), p->win, WinGetPmap(p->win), y2,
0, WinGetW(VROOT) / ww, WinGetH(VROOT), xx + y, yy, 1, hh, HIQ);
EClearArea(p->win, xx + y, yy, 1, hh, False);
EClearArea(p->win, xx + y, yy, 1, hh);
y2 = p->w;
#endif
p->update_phase++;

View File

@ -23,6 +23,7 @@
#ifndef _PIXIMG_H_
#define _PIXIMG_H_
#include <X11/Xlib.h>
#include <X11/extensions/XShm.h>
typedef struct _PixImg {

View File

@ -424,7 +424,7 @@ SessionInit(void)
return;
#if 0 /* Unused */
atom_sm_client_id = XInternAtom(disp, "SM_CLIENT_ID", False);
atom_sm_client_id = EInternAtom("SM_CLIENT_ID");
#endif
#if USE_SM
@ -514,7 +514,7 @@ doSMExit(int mode, const char *params)
{
/* We may get here from HandleXIOError */
EwinsSetFree();
XSelectInput(disp, WinGetXwin(VROOT), 0);
ESelectInput(VROOT, 0);
ExtInitWinKill();
ESync(0);

View File

@ -191,8 +191,8 @@ SetupX(const char *dstr)
numlock = scrollock = 0;
mod = XGetModifierMapping(disp);
nl = XKeysymToKeycode(disp, XK_Num_Lock);
sl = XKeysymToKeycode(disp, XK_Scroll_Lock);
nl = EKeysymToKeycode(XK_Num_Lock);
sl = EKeysymToKeycode(XK_Scroll_Lock);
if ((mod) && (mod->max_keypermod > 0))
{
for (i = 0; i < (8 * mod->max_keypermod); i++)

View File

@ -423,12 +423,10 @@ SystrayInit(Container * ct)
Esnprintf(buf, sizeof(buf), "_NET_SYSTEM_TRAY_S%d", Dpy.screen);
E_XA__XEMBED = XInternAtom(disp, "_XEMBED", False);
E_XA__XEMBED_INFO = XInternAtom(disp, "_XEMBED_INFO", False);
_NET_SYSTEM_TRAY_OPCODE =
XInternAtom(disp, "_NET_SYSTEM_TRAY_OPCODE", False);
_NET_SYSTEM_TRAY_MESSAGE_DATA =
XInternAtom(disp, "_NET_SYSTEM_TRAY_MESSAGE_DATA", False);
E_XA__XEMBED = EInternAtom("_XEMBED");
E_XA__XEMBED_INFO = EInternAtom("_XEMBED_INFO");
_NET_SYSTEM_TRAY_OPCODE = EInternAtom("_NET_SYSTEM_TRAY_OPCODE");
_NET_SYSTEM_TRAY_MESSAGE_DATA = EInternAtom("_NET_SYSTEM_TRAY_MESSAGE_DATA");
/* Acquire selection */
if (systray_sel)

85
src/x.c
View File

@ -1071,11 +1071,58 @@ ESetWindowBackground(Win win, unsigned int col)
XSetWindowBackground(disp, win->xwin, col);
}
void
ESelectInput(Win win, unsigned int event_mask)
{
XSelectInput(disp, win->xwin, event_mask);
}
void
EChangeWindowAttributes(Win win, unsigned int mask, XSetWindowAttributes * attr)
{
XChangeWindowAttributes(disp, win->xwin, mask, attr);
}
void
ESetWindowBorderWidth(Win win, unsigned int bw)
{
XSetWindowBorderWidth(disp, win->xwin, bw);
}
void
ERaiseWindow(Win win)
{
XRaiseWindow(disp, win->xwin);
}
void
ELowerWindow(Win win)
{
XLowerWindow(disp, win->xwin);
}
void
EXRestackWindows(Window * windows, int nwindows)
{
XRestackWindows(disp, windows, nwindows);
}
void
EClearWindow(Win win)
{
XClearWindow(disp, win->xwin);
}
void
EClearArea(Win win, int x, int y, unsigned int w, unsigned int h)
{
XClearArea(disp, win->xwin, x, y, w, h, False);
}
int
ETranslateCoordinates(Win src_w, Win dst_w,
int src_x, int src_y,
int *dest_x_return,
int *dest_y_return, Window * child_return)
ETranslateCoordinates(Win src_w, Win dst_w, int src_x, int src_y,
int *dest_x_return, int *dest_y_return,
Window * child_return)
{
Window child;
@ -1156,6 +1203,30 @@ EDrawableCheck(Drawable draw, int grab)
return ok;
}
KeyCode
EKeysymToKeycode(KeySym keysym)
{
return XKeysymToKeycode(disp, keysym);
}
KeyCode
EKeynameToKeycode(const char *name)
{
return XKeysymToKeycode(disp, XStringToKeysym(name));
}
const char *
EKeycodeToString(KeyCode keycode, int ix)
{
return XKeysymToString(XKeycodeToKeysym(disp, keycode, ix));
}
Atom
EInternAtom(const char *name)
{
return XInternAtom(disp, name, False);
}
#define DEBUG_SHAPE_OPS 0
#define DEBUG_SHAPE_PROPAGATE 0
@ -1629,6 +1700,12 @@ EXFreeGC(GC gc)
return XFreeGC(disp, gc);
}
void
EXSendEvent(Window xwin, long event_mask, XEvent * ev)
{
XSendEvent(disp, xwin, False, event_mask, ev);
}
void
EAllocColor(Colormap cmap, EColor * pec)
{

28
src/xtypes.h Normal file
View File

@ -0,0 +1,28 @@
/*
* Copyright (C) 2008 Kim Woelders
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies of the Software, its documentation and marketing & publicity
* materials, and acknowledgment shall be given in the documentation, materials
* and software packages that this Software was used.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef _XTYPES_H_
#define _XTYPES_H_
typedef struct _xwin *Win;
#endif /* _XTYPES_H_ */

View File

@ -27,8 +27,7 @@
#include <X11/Xlib.h>
#include <X11/extensions/shape.h>
#include "util.h"
typedef struct _xwin *Win;
#include "xtypes.h"
typedef struct {
Display *disp;
@ -206,23 +205,15 @@ int ETranslateCoordinates(Win src_w, Win dst_w,
Window * child_return);
int EDrawableCheck(Drawable draw, int grab);
#define ESelectInput(win, event_mask) \
XSelectInput(disp, WinGetXwin(win), event_mask)
#define EChangeWindowAttributes(win, mask, attr) \
XChangeWindowAttributes(disp, WinGetXwin(win), mask, attr)
#define ESetWindowBorderWidth(win, bw) \
XSetWindowBorderWidth(disp, WinGetXwin(win), bw)
#define ERaiseWindow(win) \
XRaiseWindow(disp, WinGetXwin(win))
#define ELowerWindow(win) \
XLowerWindow(disp, WinGetXwin(win))
#define EClearWindow(win) \
XClearWindow(disp, WinGetXwin(win))
#define EClearArea(win, x, y, w, h, exp) \
XClearArea(disp, WinGetXwin(win), x, y, w, h, exp)
void ESelectInput(Win win, unsigned int event_mask);
void EChangeWindowAttributes(Win win, unsigned int mask,
XSetWindowAttributes * attr);
void ESetWindowBorderWidth(Win win, unsigned int bw);
void ERaiseWindow(Win win);
void ELowerWindow(Win win);
void EClearWindow(Win win);
void EClearArea(Win win, int x, int y,
unsigned int w, unsigned int h);
Pixmap ECreatePixmap(Win win, unsigned int width,
unsigned int height, unsigned int depth);
@ -264,8 +255,8 @@ Window EXWindowGetParent(Window xwin);
int EXGetGeometry(Window xwin, Window * root_return,
int *x, int *y, int *w, int *h, int *bw,
int *depth);
#define EXGetWindowAttributes(win, xwa) \
XGetWindowAttributes(disp, WinGetXwin(win), xwa)
void EXRestackWindows(Window * windows, int nwindows);
void EXCopyArea(Drawable src, Drawable dst, int sx, int sy,
unsigned int w, unsigned int h, int dx, int dy);
@ -283,6 +274,14 @@ GC EXCreateGC(Drawable draw, unsigned long mask,
XGCValues * val);
int EXFreeGC(GC gc);
void EXSendEvent(Window xwin, long event_mask, XEvent * ev);
KeyCode EKeysymToKeycode(KeySym keysym);
KeyCode EKeynameToKeycode(const char *name);
const char *EKeycodeToString(KeyCode keycode, int index);
Atom EInternAtom(const char *name);
typedef struct {
char type;
Pixmap pmap;