Rename dsp -> display
This commit is contained in:
parent
59e56e5310
commit
106471225f
14 changed files with 365 additions and 365 deletions
|
@ -378,7 +378,7 @@ void launcher_action(LauncherIcon *icon, XEvent *evt)
|
|||
SnLauncherContext *ctx = 0;
|
||||
Time time;
|
||||
if (startup_notifications) {
|
||||
ctx = sn_launcher_context_new(server.sn_dsp, server.screen);
|
||||
ctx = sn_launcher_context_new(server.sn_display, server.screen);
|
||||
sn_launcher_context_set_name(ctx, icon->icon_tooltip);
|
||||
sn_launcher_context_set_description(ctx, "Application launched from tint2");
|
||||
sn_launcher_context_set_binary_name(ctx, icon->cmd);
|
||||
|
|
|
@ -382,9 +382,9 @@ static void check_manager_window(XSettingsClient *client)
|
|||
|
||||
XGrabServer(client->display);
|
||||
|
||||
client->manager_window = XGetSelectionOwner(server.dsp, server.atom._XSETTINGS_SCREEN);
|
||||
client->manager_window = XGetSelectionOwner(server.display, server.atom._XSETTINGS_SCREEN);
|
||||
if (client->manager_window)
|
||||
XSelectInput(server.dsp, client->manager_window, PropertyChangeMask | StructureNotifyMask);
|
||||
XSelectInput(server.display, client->manager_window, PropertyChangeMask | StructureNotifyMask);
|
||||
|
||||
XUngrabServer(client->display);
|
||||
XFlush(client->display);
|
||||
|
@ -458,7 +458,7 @@ Bool xsettings_client_process_event(XSettingsClient *client, XEvent *xev)
|
|||
* times when the manager changes from A->B. But manager changes
|
||||
* are going to be pretty rare.
|
||||
*/
|
||||
if (xev->xany.window == RootWindow(server.dsp, server.screen)) {
|
||||
if (xev->xany.window == RootWindow(server.display, server.screen)) {
|
||||
if (xev->xany.type == ClientMessage && xev->xclient.message_type == server.atom.MANAGER) {
|
||||
check_manager_window(client);
|
||||
return True;
|
||||
|
|
92
src/panel.c
92
src/panel.c
|
@ -122,13 +122,13 @@ void cleanup_panel()
|
|||
|
||||
free_area(&p->area);
|
||||
if (p->temp_pmap)
|
||||
XFreePixmap(server.dsp, p->temp_pmap);
|
||||
XFreePixmap(server.display, p->temp_pmap);
|
||||
p->temp_pmap = 0;
|
||||
if (p->hidden_pixmap)
|
||||
XFreePixmap(server.dsp, p->hidden_pixmap);
|
||||
XFreePixmap(server.display, p->hidden_pixmap);
|
||||
p->hidden_pixmap = 0;
|
||||
if (p->main_win)
|
||||
XDestroyWindow(server.dsp, p->main_win);
|
||||
XDestroyWindow(server.display, p->main_win);
|
||||
p->main_win = 0;
|
||||
stop_timeout(p->autohide_timeout);
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ void init_panel()
|
|||
// catch some events
|
||||
XSetWindowAttributes att = {.colormap = server.colormap, .background_pixel = 0, .border_pixel = 0};
|
||||
unsigned long mask = CWEventMask | CWColormap | CWBackPixel | CWBorderPixel;
|
||||
p->main_win = XCreateWindow(server.dsp,
|
||||
p->main_win = XCreateWindow(server.display,
|
||||
server.root_win,
|
||||
p->posx,
|
||||
p->posy,
|
||||
|
@ -243,18 +243,18 @@ void init_panel()
|
|||
event_mask |= PointerMotionMask | LeaveWindowMask;
|
||||
if (panel_autohide)
|
||||
event_mask |= LeaveWindowMask | EnterWindowMask;
|
||||
XChangeWindowAttributes(server.dsp, p->main_win, CWEventMask, &(XSetWindowAttributes){.event_mask = event_mask});
|
||||
XChangeWindowAttributes(server.display, p->main_win, CWEventMask, &(XSetWindowAttributes){.event_mask = event_mask});
|
||||
|
||||
if (!server.gc) {
|
||||
XGCValues gcv;
|
||||
server.gc = XCreateGC(server.dsp, p->main_win, 0, &gcv);
|
||||
server.gc = XCreateGC(server.display, p->main_win, 0, &gcv);
|
||||
}
|
||||
// printf("panel %d : %d, %d, %d, %d\n", i, p->posx, p->posy, p->area.width, p->area.height);
|
||||
set_panel_properties(p);
|
||||
set_panel_background(p);
|
||||
if (!snapshot_path) {
|
||||
// if we are not in 'snapshot' mode then map new panel
|
||||
XMapWindow(server.dsp, p->main_win);
|
||||
XMapWindow(server.display, p->main_win);
|
||||
}
|
||||
|
||||
if (panel_autohide)
|
||||
|
@ -465,8 +465,8 @@ gboolean resize_panel(void *obj)
|
|||
void update_strut(Panel *p)
|
||||
{
|
||||
if (panel_strut_policy == STRUT_NONE) {
|
||||
XDeleteProperty(server.dsp, p->main_win, server.atom._NET_WM_STRUT);
|
||||
XDeleteProperty(server.dsp, p->main_win, server.atom._NET_WM_STRUT_PARTIAL);
|
||||
XDeleteProperty(server.display, p->main_win, server.atom._NET_WM_STRUT);
|
||||
XDeleteProperty(server.display, p->main_win, server.atom._NET_WM_STRUT_PARTIAL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -474,7 +474,7 @@ void update_strut(Panel *p)
|
|||
unsigned int d1, screen_width, screen_height;
|
||||
Window d2;
|
||||
int d3;
|
||||
XGetGeometry(server.dsp, server.root_win, &d2, &d3, &d3, &screen_width, &screen_height, &d1, &d1);
|
||||
XGetGeometry(server.display, server.root_win, &d2, &d3, &d3, &screen_width, &screen_height, &d1, &d1);
|
||||
Monitor monitor = server.monitors[p->monitor];
|
||||
long struts[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
if (panel_horizontal) {
|
||||
|
@ -509,7 +509,7 @@ void update_strut(Panel *p)
|
|||
}
|
||||
}
|
||||
// Old specification : fluxbox need _NET_WM_STRUT.
|
||||
XChangeProperty(server.dsp,
|
||||
XChangeProperty(server.display,
|
||||
p->main_win,
|
||||
server.atom._NET_WM_STRUT,
|
||||
XA_CARDINAL,
|
||||
|
@ -517,7 +517,7 @@ void update_strut(Panel *p)
|
|||
PropModeReplace,
|
||||
(unsigned char *)&struts,
|
||||
4);
|
||||
XChangeProperty(server.dsp,
|
||||
XChangeProperty(server.display,
|
||||
p->main_win,
|
||||
server.atom._NET_WM_STRUT_PARTIAL,
|
||||
XA_CARDINAL,
|
||||
|
@ -568,13 +568,13 @@ void set_panel_items_order(Panel *p)
|
|||
|
||||
void set_panel_properties(Panel *p)
|
||||
{
|
||||
XStoreName(server.dsp, p->main_win, panel_window_name);
|
||||
XSetIconName(server.dsp, p->main_win, panel_window_name);
|
||||
XStoreName(server.display, p->main_win, panel_window_name);
|
||||
XSetIconName(server.display, p->main_win, panel_window_name);
|
||||
|
||||
gsize len;
|
||||
gchar *name = g_locale_to_utf8(panel_window_name, -1, NULL, &len, NULL);
|
||||
if (name != NULL) {
|
||||
XChangeProperty(server.dsp,
|
||||
XChangeProperty(server.display,
|
||||
p->main_win,
|
||||
server.atom._NET_WM_NAME,
|
||||
server.atom.UTF8_STRING,
|
||||
|
@ -582,7 +582,7 @@ void set_panel_properties(Panel *p)
|
|||
PropModeReplace,
|
||||
(unsigned char *)name,
|
||||
(int)len);
|
||||
XChangeProperty(server.dsp,
|
||||
XChangeProperty(server.display,
|
||||
p->main_win,
|
||||
server.atom._NET_WM_ICON_NAME,
|
||||
server.atom.UTF8_STRING,
|
||||
|
@ -595,7 +595,7 @@ void set_panel_properties(Panel *p)
|
|||
|
||||
// Dock
|
||||
long val = server.atom._NET_WM_WINDOW_TYPE_DOCK;
|
||||
XChangeProperty(server.dsp,
|
||||
XChangeProperty(server.display,
|
||||
p->main_win,
|
||||
server.atom._NET_WM_WINDOW_TYPE,
|
||||
XA_ATOM,
|
||||
|
@ -605,7 +605,7 @@ void set_panel_properties(Panel *p)
|
|||
1);
|
||||
|
||||
val = ALL_DESKTOPS;
|
||||
XChangeProperty(server.dsp,
|
||||
XChangeProperty(server.display,
|
||||
p->main_win,
|
||||
server.atom._NET_WM_DESKTOP,
|
||||
XA_CARDINAL,
|
||||
|
@ -620,7 +620,7 @@ void set_panel_properties(Panel *p)
|
|||
state[2] = server.atom._NET_WM_STATE_STICKY;
|
||||
state[3] = panel_layer == BOTTOM_LAYER ? server.atom._NET_WM_STATE_BELOW : server.atom._NET_WM_STATE_ABOVE;
|
||||
int num_atoms = panel_layer == NORMAL_LAYER ? 3 : 4;
|
||||
XChangeProperty(server.dsp,
|
||||
XChangeProperty(server.display,
|
||||
p->main_win,
|
||||
server.atom._NET_WM_STATE,
|
||||
XA_ATOM,
|
||||
|
@ -641,11 +641,11 @@ void set_panel_properties(Panel *p)
|
|||
// We do not need keyboard input focus.
|
||||
wmhints.flags |= InputHint;
|
||||
wmhints.input = False;
|
||||
XSetWMHints(server.dsp, p->main_win, &wmhints);
|
||||
XSetWMHints(server.display, p->main_win, &wmhints);
|
||||
|
||||
// Undecorated
|
||||
long prop[5] = {2, 0, 0, 0, 0};
|
||||
XChangeProperty(server.dsp,
|
||||
XChangeProperty(server.display,
|
||||
p->main_win,
|
||||
server.atom._MOTIF_WM_HINTS,
|
||||
server.atom._MOTIF_WM_HINTS,
|
||||
|
@ -656,7 +656,7 @@ void set_panel_properties(Panel *p)
|
|||
|
||||
// XdndAware - Register for Xdnd events
|
||||
Atom version = 4;
|
||||
XChangeProperty(server.dsp,
|
||||
XChangeProperty(server.display,
|
||||
p->main_win,
|
||||
server.atom.XdndAware,
|
||||
XA_ATOM,
|
||||
|
@ -677,21 +677,21 @@ void set_panel_properties(Panel *p)
|
|||
size_hints.max_width = p->area.width;
|
||||
size_hints.min_height = minheight;
|
||||
size_hints.max_height = p->area.height;
|
||||
XSetWMNormalHints(server.dsp, p->main_win, &size_hints);
|
||||
XSetWMNormalHints(server.display, p->main_win, &size_hints);
|
||||
|
||||
// Set WM_CLASS
|
||||
XClassHint *classhint = XAllocClassHint();
|
||||
classhint->res_name = (char *)"tint2";
|
||||
classhint->res_class = (char *)"Tint2";
|
||||
XSetClassHint(server.dsp, p->main_win, classhint);
|
||||
XSetClassHint(server.display, p->main_win, classhint);
|
||||
XFree(classhint);
|
||||
}
|
||||
|
||||
void set_panel_background(Panel *p)
|
||||
{
|
||||
if (p->area.pix)
|
||||
XFreePixmap(server.dsp, p->area.pix);
|
||||
p->area.pix = XCreatePixmap(server.dsp, server.root_win, p->area.width, p->area.height, server.depth);
|
||||
XFreePixmap(server.display, p->area.pix);
|
||||
p->area.pix = XCreatePixmap(server.display, server.root_win, p->area.width, p->area.height, server.depth);
|
||||
|
||||
int xoff = 0, yoff = 0;
|
||||
if (panel_horizontal && panel_position & BOTTOM)
|
||||
|
@ -706,17 +706,17 @@ void set_panel_background(Panel *p)
|
|||
// copy background (server.root_pmap) in panel.area.pix
|
||||
Window dummy;
|
||||
int x, y;
|
||||
XTranslateCoordinates(server.dsp, p->main_win, server.root_win, 0, 0, &x, &y, &dummy);
|
||||
XTranslateCoordinates(server.display, p->main_win, server.root_win, 0, 0, &x, &y, &dummy);
|
||||
if (panel_autohide && p->is_hidden) {
|
||||
x -= xoff;
|
||||
y -= yoff;
|
||||
}
|
||||
XSetTSOrigin(server.dsp, server.gc, -x, -y);
|
||||
XFillRectangle(server.dsp, p->area.pix, server.gc, 0, 0, p->area.width, p->area.height);
|
||||
XSetTSOrigin(server.display, server.gc, -x, -y);
|
||||
XFillRectangle(server.display, p->area.pix, server.gc, 0, 0, p->area.width, p->area.height);
|
||||
}
|
||||
|
||||
// draw background panel
|
||||
cairo_surface_t *cs = cairo_xlib_surface_create(server.dsp, p->area.pix, server.visual, p->area.width, p->area.height);
|
||||
cairo_surface_t *cs = cairo_xlib_surface_create(server.display, p->area.pix, server.visual, p->area.width, p->area.height);
|
||||
cairo_t *c = cairo_create(cs);
|
||||
draw_background(&p->area, c);
|
||||
cairo_destroy(c);
|
||||
|
@ -724,9 +724,9 @@ void set_panel_background(Panel *p)
|
|||
|
||||
if (panel_autohide) {
|
||||
if (p->hidden_pixmap)
|
||||
XFreePixmap(server.dsp, p->hidden_pixmap);
|
||||
p->hidden_pixmap = XCreatePixmap(server.dsp, server.root_win, p->hidden_width, p->hidden_height, server.depth);
|
||||
XCopyArea(server.dsp,
|
||||
XFreePixmap(server.display, p->hidden_pixmap);
|
||||
p->hidden_pixmap = XCreatePixmap(server.display, server.root_win, p->hidden_width, p->hidden_height, server.depth);
|
||||
XCopyArea(server.display,
|
||||
p->area.pix,
|
||||
p->hidden_pixmap,
|
||||
server.gc,
|
||||
|
@ -750,10 +750,10 @@ void set_panel_background(Panel *p)
|
|||
taskbar = &p->taskbar[i];
|
||||
for (int k = 0; k < TASKBAR_STATE_COUNT; ++k) {
|
||||
if (taskbar->state_pix[k])
|
||||
XFreePixmap(server.dsp, taskbar->state_pix[k]);
|
||||
XFreePixmap(server.display, taskbar->state_pix[k]);
|
||||
taskbar->state_pix[k] = 0;
|
||||
if (taskbar->bar_name.state_pix[k])
|
||||
XFreePixmap(server.dsp, taskbar->bar_name.state_pix[k]);
|
||||
XFreePixmap(server.display, taskbar->bar_name.state_pix[k]);
|
||||
taskbar->bar_name.state_pix[k] = 0;
|
||||
}
|
||||
taskbar->area.pix = 0;
|
||||
|
@ -941,12 +941,12 @@ void autohide_show(void *p)
|
|||
stop_autohide_timeout(panel);
|
||||
panel->is_hidden = 0;
|
||||
|
||||
XMapSubwindows(server.dsp, panel->main_win); // systray windows
|
||||
XMapSubwindows(server.display, panel->main_win); // systray windows
|
||||
if (panel_horizontal) {
|
||||
if (panel_position & TOP)
|
||||
XResizeWindow(server.dsp, panel->main_win, panel->area.width, panel->area.height);
|
||||
XResizeWindow(server.display, panel->main_win, panel->area.width, panel->area.height);
|
||||
else
|
||||
XMoveResizeWindow(server.dsp,
|
||||
XMoveResizeWindow(server.display,
|
||||
panel->main_win,
|
||||
panel->posx,
|
||||
panel->posy,
|
||||
|
@ -954,9 +954,9 @@ void autohide_show(void *p)
|
|||
panel->area.height);
|
||||
} else {
|
||||
if (panel_position & LEFT)
|
||||
XResizeWindow(server.dsp, panel->main_win, panel->area.width, panel->area.height);
|
||||
XResizeWindow(server.display, panel->main_win, panel->area.width, panel->area.height);
|
||||
else
|
||||
XMoveResizeWindow(server.dsp,
|
||||
XMoveResizeWindow(server.display,
|
||||
panel->main_win,
|
||||
panel->posx,
|
||||
panel->posy,
|
||||
|
@ -977,14 +977,14 @@ void autohide_hide(void *p)
|
|||
if (panel_strut_policy == STRUT_FOLLOW_SIZE)
|
||||
update_strut(panel);
|
||||
|
||||
XUnmapSubwindows(server.dsp, panel->main_win); // systray windows
|
||||
XUnmapSubwindows(server.display, panel->main_win); // systray windows
|
||||
int diff = (panel_horizontal ? panel->area.height : panel->area.width) - panel_autohide_height;
|
||||
// printf("autohide_hide : diff %d, w %d, h %d\n", diff, panel->hidden_width, panel->hidden_height);
|
||||
if (panel_horizontal) {
|
||||
if (panel_position & TOP)
|
||||
XResizeWindow(server.dsp, panel->main_win, panel->hidden_width, panel->hidden_height);
|
||||
XResizeWindow(server.display, panel->main_win, panel->hidden_width, panel->hidden_height);
|
||||
else
|
||||
XMoveResizeWindow(server.dsp,
|
||||
XMoveResizeWindow(server.display,
|
||||
panel->main_win,
|
||||
panel->posx,
|
||||
panel->posy + diff,
|
||||
|
@ -992,9 +992,9 @@ void autohide_hide(void *p)
|
|||
panel->hidden_height);
|
||||
} else {
|
||||
if (panel_position & LEFT)
|
||||
XResizeWindow(server.dsp, panel->main_win, panel->hidden_width, panel->hidden_height);
|
||||
XResizeWindow(server.display, panel->main_win, panel->hidden_width, panel->hidden_height);
|
||||
else
|
||||
XMoveResizeWindow(server.dsp,
|
||||
XMoveResizeWindow(server.display,
|
||||
panel->main_win,
|
||||
panel->posx + diff,
|
||||
panel->posy,
|
||||
|
@ -1019,7 +1019,7 @@ void autohide_trigger_hide(Panel *p)
|
|||
Window root, child;
|
||||
int xr, yr, xw, yw;
|
||||
unsigned int mask;
|
||||
if (XQueryPointer(server.dsp, p->main_win, &root, &child, &xr, &yr, &xw, &yw, &mask))
|
||||
if (XQueryPointer(server.display, p->main_win, &root, &child, &xr, &yr, &xw, &yw, &mask))
|
||||
if (child)
|
||||
return; // mouse over one of the system tray icons
|
||||
|
||||
|
|
202
src/server.c
202
src/server.c
|
@ -39,94 +39,94 @@ void server_catch_error(Display *d, XErrorEvent *ev)
|
|||
|
||||
void server_init_atoms()
|
||||
{
|
||||
server.atom._XROOTPMAP_ID = XInternAtom(server.dsp, "_XROOTPMAP_ID", False);
|
||||
server.atom._XROOTMAP_ID = XInternAtom(server.dsp, "_XROOTMAP_ID", False);
|
||||
server.atom._NET_CURRENT_DESKTOP = XInternAtom(server.dsp, "_NET_CURRENT_DESKTOP", False);
|
||||
server.atom._NET_NUMBER_OF_DESKTOPS = XInternAtom(server.dsp, "_NET_NUMBER_OF_DESKTOPS", False);
|
||||
server.atom._NET_DESKTOP_NAMES = XInternAtom(server.dsp, "_NET_DESKTOP_NAMES", False);
|
||||
server.atom._NET_DESKTOP_GEOMETRY = XInternAtom(server.dsp, "_NET_DESKTOP_GEOMETRY", False);
|
||||
server.atom._NET_DESKTOP_VIEWPORT = XInternAtom(server.dsp, "_NET_DESKTOP_VIEWPORT", False);
|
||||
server.atom._NET_WORKAREA = XInternAtom(server.dsp, "_NET_WORKAREA", False);
|
||||
server.atom._NET_ACTIVE_WINDOW = XInternAtom(server.dsp, "_NET_ACTIVE_WINDOW", False);
|
||||
server.atom._NET_WM_WINDOW_TYPE = XInternAtom(server.dsp, "_NET_WM_WINDOW_TYPE", False);
|
||||
server.atom._NET_WM_STATE_SKIP_PAGER = XInternAtom(server.dsp, "_NET_WM_STATE_SKIP_PAGER", False);
|
||||
server.atom._NET_WM_STATE_SKIP_TASKBAR = XInternAtom(server.dsp, "_NET_WM_STATE_SKIP_TASKBAR", False);
|
||||
server.atom._NET_WM_STATE_STICKY = XInternAtom(server.dsp, "_NET_WM_STATE_STICKY", False);
|
||||
server.atom._NET_WM_STATE_DEMANDS_ATTENTION = XInternAtom(server.dsp, "_NET_WM_STATE_DEMANDS_ATTENTION", False);
|
||||
server.atom._NET_WM_WINDOW_TYPE_DOCK = XInternAtom(server.dsp, "_NET_WM_WINDOW_TYPE_DOCK", False);
|
||||
server.atom._NET_WM_WINDOW_TYPE_DESKTOP = XInternAtom(server.dsp, "_NET_WM_WINDOW_TYPE_DESKTOP", False);
|
||||
server.atom._NET_WM_WINDOW_TYPE_TOOLBAR = XInternAtom(server.dsp, "_NET_WM_WINDOW_TYPE_TOOLBAR", False);
|
||||
server.atom._NET_WM_WINDOW_TYPE_MENU = XInternAtom(server.dsp, "_NET_WM_WINDOW_TYPE_MENU", False);
|
||||
server.atom._NET_WM_WINDOW_TYPE_SPLASH = XInternAtom(server.dsp, "_NET_WM_WINDOW_TYPE_SPLASH", False);
|
||||
server.atom._NET_WM_WINDOW_TYPE_DIALOG = XInternAtom(server.dsp, "_NET_WM_WINDOW_TYPE_DIALOG", False);
|
||||
server.atom._NET_WM_WINDOW_TYPE_NORMAL = XInternAtom(server.dsp, "_NET_WM_WINDOW_TYPE_NORMAL", False);
|
||||
server.atom._NET_WM_DESKTOP = XInternAtom(server.dsp, "_NET_WM_DESKTOP", False);
|
||||
server.atom.WM_STATE = XInternAtom(server.dsp, "WM_STATE", False);
|
||||
server.atom._NET_WM_STATE = XInternAtom(server.dsp, "_NET_WM_STATE", False);
|
||||
server.atom._NET_WM_STATE_MAXIMIZED_VERT = XInternAtom(server.dsp, "_NET_WM_STATE_MAXIMIZED_VERT", False);
|
||||
server.atom._NET_WM_STATE_MAXIMIZED_HORZ = XInternAtom(server.dsp, "_NET_WM_STATE_MAXIMIZED_HORZ", False);
|
||||
server.atom._NET_WM_STATE_SHADED = XInternAtom(server.dsp, "_NET_WM_STATE_SHADED", False);
|
||||
server.atom._NET_WM_STATE_HIDDEN = XInternAtom(server.dsp, "_NET_WM_STATE_HIDDEN", False);
|
||||
server.atom._NET_WM_STATE_BELOW = XInternAtom(server.dsp, "_NET_WM_STATE_BELOW", False);
|
||||
server.atom._NET_WM_STATE_ABOVE = XInternAtom(server.dsp, "_NET_WM_STATE_ABOVE", False);
|
||||
server.atom._NET_WM_STATE_MODAL = XInternAtom(server.dsp, "_NET_WM_STATE_MODAL", False);
|
||||
server.atom._NET_CLIENT_LIST = XInternAtom(server.dsp, "_NET_CLIENT_LIST", False);
|
||||
server.atom._NET_WM_VISIBLE_NAME = XInternAtom(server.dsp, "_NET_WM_VISIBLE_NAME", False);
|
||||
server.atom._NET_WM_NAME = XInternAtom(server.dsp, "_NET_WM_NAME", False);
|
||||
server.atom._NET_WM_STRUT = XInternAtom(server.dsp, "_NET_WM_STRUT", False);
|
||||
server.atom._NET_WM_ICON = XInternAtom(server.dsp, "_NET_WM_ICON", False);
|
||||
server.atom._NET_WM_ICON_GEOMETRY = XInternAtom(server.dsp, "_NET_WM_ICON_GEOMETRY", False);
|
||||
server.atom._NET_WM_ICON_NAME = XInternAtom(server.dsp, "_NET_WM_ICON_NAME", False);
|
||||
server.atom._NET_CLOSE_WINDOW = XInternAtom(server.dsp, "_NET_CLOSE_WINDOW", False);
|
||||
server.atom.UTF8_STRING = XInternAtom(server.dsp, "UTF8_STRING", False);
|
||||
server.atom._NET_SUPPORTING_WM_CHECK = XInternAtom(server.dsp, "_NET_SUPPORTING_WM_CHECK", False);
|
||||
server.atom._NET_WM_CM_S0 = XInternAtom(server.dsp, "_NET_WM_CM_S0", False);
|
||||
server.atom._NET_SUPPORTING_WM_CHECK = XInternAtom(server.dsp, "_NET_WM_NAME", False);
|
||||
server.atom._NET_WM_STRUT_PARTIAL = XInternAtom(server.dsp, "_NET_WM_STRUT_PARTIAL", False);
|
||||
server.atom.WM_NAME = XInternAtom(server.dsp, "WM_NAME", False);
|
||||
server.atom.__SWM_VROOT = XInternAtom(server.dsp, "__SWM_VROOT", False);
|
||||
server.atom._MOTIF_WM_HINTS = XInternAtom(server.dsp, "_MOTIF_WM_HINTS", False);
|
||||
server.atom.WM_HINTS = XInternAtom(server.dsp, "WM_HINTS", False);
|
||||
gchar *name = g_strdup_printf("_XSETTINGS_S%d", DefaultScreen(server.dsp));
|
||||
server.atom._XSETTINGS_SCREEN = XInternAtom(server.dsp, name, False);
|
||||
server.atom._XROOTPMAP_ID = XInternAtom(server.display, "_XROOTPMAP_ID", False);
|
||||
server.atom._XROOTMAP_ID = XInternAtom(server.display, "_XROOTMAP_ID", False);
|
||||
server.atom._NET_CURRENT_DESKTOP = XInternAtom(server.display, "_NET_CURRENT_DESKTOP", False);
|
||||
server.atom._NET_NUMBER_OF_DESKTOPS = XInternAtom(server.display, "_NET_NUMBER_OF_DESKTOPS", False);
|
||||
server.atom._NET_DESKTOP_NAMES = XInternAtom(server.display, "_NET_DESKTOP_NAMES", False);
|
||||
server.atom._NET_DESKTOP_GEOMETRY = XInternAtom(server.display, "_NET_DESKTOP_GEOMETRY", False);
|
||||
server.atom._NET_DESKTOP_VIEWPORT = XInternAtom(server.display, "_NET_DESKTOP_VIEWPORT", False);
|
||||
server.atom._NET_WORKAREA = XInternAtom(server.display, "_NET_WORKAREA", False);
|
||||
server.atom._NET_ACTIVE_WINDOW = XInternAtom(server.display, "_NET_ACTIVE_WINDOW", False);
|
||||
server.atom._NET_WM_WINDOW_TYPE = XInternAtom(server.display, "_NET_WM_WINDOW_TYPE", False);
|
||||
server.atom._NET_WM_STATE_SKIP_PAGER = XInternAtom(server.display, "_NET_WM_STATE_SKIP_PAGER", False);
|
||||
server.atom._NET_WM_STATE_SKIP_TASKBAR = XInternAtom(server.display, "_NET_WM_STATE_SKIP_TASKBAR", False);
|
||||
server.atom._NET_WM_STATE_STICKY = XInternAtom(server.display, "_NET_WM_STATE_STICKY", False);
|
||||
server.atom._NET_WM_STATE_DEMANDS_ATTENTION = XInternAtom(server.display, "_NET_WM_STATE_DEMANDS_ATTENTION", False);
|
||||
server.atom._NET_WM_WINDOW_TYPE_DOCK = XInternAtom(server.display, "_NET_WM_WINDOW_TYPE_DOCK", False);
|
||||
server.atom._NET_WM_WINDOW_TYPE_DESKTOP = XInternAtom(server.display, "_NET_WM_WINDOW_TYPE_DESKTOP", False);
|
||||
server.atom._NET_WM_WINDOW_TYPE_TOOLBAR = XInternAtom(server.display, "_NET_WM_WINDOW_TYPE_TOOLBAR", False);
|
||||
server.atom._NET_WM_WINDOW_TYPE_MENU = XInternAtom(server.display, "_NET_WM_WINDOW_TYPE_MENU", False);
|
||||
server.atom._NET_WM_WINDOW_TYPE_SPLASH = XInternAtom(server.display, "_NET_WM_WINDOW_TYPE_SPLASH", False);
|
||||
server.atom._NET_WM_WINDOW_TYPE_DIALOG = XInternAtom(server.display, "_NET_WM_WINDOW_TYPE_DIALOG", False);
|
||||
server.atom._NET_WM_WINDOW_TYPE_NORMAL = XInternAtom(server.display, "_NET_WM_WINDOW_TYPE_NORMAL", False);
|
||||
server.atom._NET_WM_DESKTOP = XInternAtom(server.display, "_NET_WM_DESKTOP", False);
|
||||
server.atom.WM_STATE = XInternAtom(server.display, "WM_STATE", False);
|
||||
server.atom._NET_WM_STATE = XInternAtom(server.display, "_NET_WM_STATE", False);
|
||||
server.atom._NET_WM_STATE_MAXIMIZED_VERT = XInternAtom(server.display, "_NET_WM_STATE_MAXIMIZED_VERT", False);
|
||||
server.atom._NET_WM_STATE_MAXIMIZED_HORZ = XInternAtom(server.display, "_NET_WM_STATE_MAXIMIZED_HORZ", False);
|
||||
server.atom._NET_WM_STATE_SHADED = XInternAtom(server.display, "_NET_WM_STATE_SHADED", False);
|
||||
server.atom._NET_WM_STATE_HIDDEN = XInternAtom(server.display, "_NET_WM_STATE_HIDDEN", False);
|
||||
server.atom._NET_WM_STATE_BELOW = XInternAtom(server.display, "_NET_WM_STATE_BELOW", False);
|
||||
server.atom._NET_WM_STATE_ABOVE = XInternAtom(server.display, "_NET_WM_STATE_ABOVE", False);
|
||||
server.atom._NET_WM_STATE_MODAL = XInternAtom(server.display, "_NET_WM_STATE_MODAL", False);
|
||||
server.atom._NET_CLIENT_LIST = XInternAtom(server.display, "_NET_CLIENT_LIST", False);
|
||||
server.atom._NET_WM_VISIBLE_NAME = XInternAtom(server.display, "_NET_WM_VISIBLE_NAME", False);
|
||||
server.atom._NET_WM_NAME = XInternAtom(server.display, "_NET_WM_NAME", False);
|
||||
server.atom._NET_WM_STRUT = XInternAtom(server.display, "_NET_WM_STRUT", False);
|
||||
server.atom._NET_WM_ICON = XInternAtom(server.display, "_NET_WM_ICON", False);
|
||||
server.atom._NET_WM_ICON_GEOMETRY = XInternAtom(server.display, "_NET_WM_ICON_GEOMETRY", False);
|
||||
server.atom._NET_WM_ICON_NAME = XInternAtom(server.display, "_NET_WM_ICON_NAME", False);
|
||||
server.atom._NET_CLOSE_WINDOW = XInternAtom(server.display, "_NET_CLOSE_WINDOW", False);
|
||||
server.atom.UTF8_STRING = XInternAtom(server.display, "UTF8_STRING", False);
|
||||
server.atom._NET_SUPPORTING_WM_CHECK = XInternAtom(server.display, "_NET_SUPPORTING_WM_CHECK", False);
|
||||
server.atom._NET_WM_CM_S0 = XInternAtom(server.display, "_NET_WM_CM_S0", False);
|
||||
server.atom._NET_SUPPORTING_WM_CHECK = XInternAtom(server.display, "_NET_WM_NAME", False);
|
||||
server.atom._NET_WM_STRUT_PARTIAL = XInternAtom(server.display, "_NET_WM_STRUT_PARTIAL", False);
|
||||
server.atom.WM_NAME = XInternAtom(server.display, "WM_NAME", False);
|
||||
server.atom.__SWM_VROOT = XInternAtom(server.display, "__SWM_VROOT", False);
|
||||
server.atom._MOTIF_WM_HINTS = XInternAtom(server.display, "_MOTIF_WM_HINTS", False);
|
||||
server.atom.WM_HINTS = XInternAtom(server.display, "WM_HINTS", False);
|
||||
gchar *name = g_strdup_printf("_XSETTINGS_S%d", DefaultScreen(server.display));
|
||||
server.atom._XSETTINGS_SCREEN = XInternAtom(server.display, name, False);
|
||||
g_free(name);
|
||||
server.atom._XSETTINGS_SETTINGS = XInternAtom(server.dsp, "_XSETTINGS_SETTINGS", False);
|
||||
server.atom._XSETTINGS_SETTINGS = XInternAtom(server.display, "_XSETTINGS_SETTINGS", False);
|
||||
|
||||
// systray protocol
|
||||
name = g_strdup_printf("_NET_SYSTEM_TRAY_S%d", DefaultScreen(server.dsp));
|
||||
server.atom._NET_SYSTEM_TRAY_SCREEN = XInternAtom(server.dsp, name, False);
|
||||
name = g_strdup_printf("_NET_SYSTEM_TRAY_S%d", DefaultScreen(server.display));
|
||||
server.atom._NET_SYSTEM_TRAY_SCREEN = XInternAtom(server.display, name, False);
|
||||
g_free(name);
|
||||
server.atom._NET_SYSTEM_TRAY_OPCODE = XInternAtom(server.dsp, "_NET_SYSTEM_TRAY_OPCODE", False);
|
||||
server.atom.MANAGER = XInternAtom(server.dsp, "MANAGER", False);
|
||||
server.atom._NET_SYSTEM_TRAY_MESSAGE_DATA = XInternAtom(server.dsp, "_NET_SYSTEM_TRAY_MESSAGE_DATA", False);
|
||||
server.atom._NET_SYSTEM_TRAY_ORIENTATION = XInternAtom(server.dsp, "_NET_SYSTEM_TRAY_ORIENTATION", False);
|
||||
server.atom._NET_SYSTEM_TRAY_ICON_SIZE = XInternAtom(server.dsp, "_NET_SYSTEM_TRAY_ICON_SIZE", False);
|
||||
server.atom._NET_SYSTEM_TRAY_PADDING = XInternAtom(server.dsp, "_NET_SYSTEM_TRAY_PADDING", False);
|
||||
server.atom._XEMBED = XInternAtom(server.dsp, "_XEMBED", False);
|
||||
server.atom._XEMBED_INFO = XInternAtom(server.dsp, "_XEMBED_INFO", False);
|
||||
server.atom._NET_WM_PID = XInternAtom(server.dsp, "_NET_WM_PID", True);
|
||||
server.atom._NET_SYSTEM_TRAY_OPCODE = XInternAtom(server.display, "_NET_SYSTEM_TRAY_OPCODE", False);
|
||||
server.atom.MANAGER = XInternAtom(server.display, "MANAGER", False);
|
||||
server.atom._NET_SYSTEM_TRAY_MESSAGE_DATA = XInternAtom(server.display, "_NET_SYSTEM_TRAY_MESSAGE_DATA", False);
|
||||
server.atom._NET_SYSTEM_TRAY_ORIENTATION = XInternAtom(server.display, "_NET_SYSTEM_TRAY_ORIENTATION", False);
|
||||
server.atom._NET_SYSTEM_TRAY_ICON_SIZE = XInternAtom(server.display, "_NET_SYSTEM_TRAY_ICON_SIZE", False);
|
||||
server.atom._NET_SYSTEM_TRAY_PADDING = XInternAtom(server.display, "_NET_SYSTEM_TRAY_PADDING", False);
|
||||
server.atom._XEMBED = XInternAtom(server.display, "_XEMBED", False);
|
||||
server.atom._XEMBED_INFO = XInternAtom(server.display, "_XEMBED_INFO", False);
|
||||
server.atom._NET_WM_PID = XInternAtom(server.display, "_NET_WM_PID", True);
|
||||
|
||||
// drag 'n' drop
|
||||
server.atom.XdndAware = XInternAtom(server.dsp, "XdndAware", False);
|
||||
server.atom.XdndEnter = XInternAtom(server.dsp, "XdndEnter", False);
|
||||
server.atom.XdndPosition = XInternAtom(server.dsp, "XdndPosition", False);
|
||||
server.atom.XdndStatus = XInternAtom(server.dsp, "XdndStatus", False);
|
||||
server.atom.XdndDrop = XInternAtom(server.dsp, "XdndDrop", False);
|
||||
server.atom.XdndLeave = XInternAtom(server.dsp, "XdndLeave", False);
|
||||
server.atom.XdndSelection = XInternAtom(server.dsp, "XdndSelection", False);
|
||||
server.atom.XdndTypeList = XInternAtom(server.dsp, "XdndTypeList", False);
|
||||
server.atom.XdndActionCopy = XInternAtom(server.dsp, "XdndActionCopy", False);
|
||||
server.atom.XdndFinished = XInternAtom(server.dsp, "XdndFinished", False);
|
||||
server.atom.TARGETS = XInternAtom(server.dsp, "TARGETS", False);
|
||||
server.atom.XdndAware = XInternAtom(server.display, "XdndAware", False);
|
||||
server.atom.XdndEnter = XInternAtom(server.display, "XdndEnter", False);
|
||||
server.atom.XdndPosition = XInternAtom(server.display, "XdndPosition", False);
|
||||
server.atom.XdndStatus = XInternAtom(server.display, "XdndStatus", False);
|
||||
server.atom.XdndDrop = XInternAtom(server.display, "XdndDrop", False);
|
||||
server.atom.XdndLeave = XInternAtom(server.display, "XdndLeave", False);
|
||||
server.atom.XdndSelection = XInternAtom(server.display, "XdndSelection", False);
|
||||
server.atom.XdndTypeList = XInternAtom(server.display, "XdndTypeList", False);
|
||||
server.atom.XdndActionCopy = XInternAtom(server.display, "XdndActionCopy", False);
|
||||
server.atom.XdndFinished = XInternAtom(server.display, "XdndFinished", False);
|
||||
server.atom.TARGETS = XInternAtom(server.display, "TARGETS", False);
|
||||
}
|
||||
|
||||
void cleanup_server()
|
||||
{
|
||||
if (server.colormap)
|
||||
XFreeColormap(server.dsp, server.colormap);
|
||||
XFreeColormap(server.display, server.colormap);
|
||||
server.colormap = 0;
|
||||
if (server.colormap32)
|
||||
XFreeColormap(server.dsp, server.colormap32);
|
||||
XFreeColormap(server.display, server.colormap32);
|
||||
server.colormap32 = 0;
|
||||
if (server.monitors) {
|
||||
for (int i = 0; i < server.num_monitors; ++i) {
|
||||
|
@ -137,7 +137,7 @@ void cleanup_server()
|
|||
server.monitors = NULL;
|
||||
}
|
||||
if (server.gc)
|
||||
XFreeGC(server.dsp, server.gc);
|
||||
XFreeGC(server.display, server.gc);
|
||||
server.gc = NULL;
|
||||
server.disable_transparency = FALSE;
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ void send_event32(Window win, Atom at, long data1, long data2, long data3)
|
|||
event.xclient.type = ClientMessage;
|
||||
event.xclient.serial = 0;
|
||||
event.xclient.send_event = True;
|
||||
event.xclient.display = server.dsp;
|
||||
event.xclient.display = server.display;
|
||||
event.xclient.window = win;
|
||||
event.xclient.message_type = at;
|
||||
|
||||
|
@ -160,7 +160,7 @@ void send_event32(Window win, Atom at, long data1, long data2, long data3)
|
|||
event.xclient.data.l[3] = 0;
|
||||
event.xclient.data.l[4] = 0;
|
||||
|
||||
XSendEvent(server.dsp, server.root_win, False, SubstructureRedirectMask | SubstructureNotifyMask, &event);
|
||||
XSendEvent(server.display, server.root_win, False, SubstructureRedirectMask | SubstructureNotifyMask, &event);
|
||||
}
|
||||
|
||||
int get_property32(Window win, Atom at, Atom type)
|
||||
|
@ -175,7 +175,7 @@ int get_property32(Window win, Atom at, Atom type)
|
|||
if (!win)
|
||||
return 0;
|
||||
|
||||
result = XGetWindowProperty(server.dsp,
|
||||
result = XGetWindowProperty(server.display,
|
||||
win,
|
||||
at,
|
||||
0,
|
||||
|
@ -206,7 +206,7 @@ void *server_get_property(Window win, Atom at, Atom type, int *num_results)
|
|||
if (!win)
|
||||
return NULL;
|
||||
|
||||
int result = XGetWindowProperty(server.dsp,
|
||||
int result = XGetWindowProperty(server.display,
|
||||
win,
|
||||
at,
|
||||
0,
|
||||
|
@ -254,7 +254,7 @@ void get_root_pixmap()
|
|||
uint mask = GCTileStipXOrigin | GCTileStipYOrigin | GCFillStyle | GCTile;
|
||||
|
||||
gcv.tile = server.root_pmap;
|
||||
XChangeGC(server.dsp, server.gc, mask, &gcv);
|
||||
XChangeGC(server.display, server.gc, mask, &gcv);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -299,11 +299,11 @@ int monitor_includes_monitor(const void *monitor1, const void *monitor2)
|
|||
|
||||
void get_monitors()
|
||||
{
|
||||
if (XineramaIsActive(server.dsp)) {
|
||||
if (XineramaIsActive(server.display)) {
|
||||
int num_monitors;
|
||||
XineramaScreenInfo *info = XineramaQueryScreens(server.dsp, &num_monitors);
|
||||
XRRScreenResources *res = XRRGetScreenResourcesCurrent(server.dsp, server.root_win);
|
||||
RROutput primary_output = XRRGetOutputPrimary(server.dsp, server.root_win);
|
||||
XineramaScreenInfo *info = XineramaQueryScreens(server.display, &num_monitors);
|
||||
XRRScreenResources *res = XRRGetScreenResourcesCurrent(server.display, server.root_win);
|
||||
RROutput primary_output = XRRGetOutputPrimary(server.display, server.root_win);
|
||||
|
||||
if (res && res->ncrtc >= num_monitors) {
|
||||
// use xrandr to identify monitors (does not work with proprietery nvidia drivers)
|
||||
|
@ -312,7 +312,7 @@ void get_monitors()
|
|||
// on some recent configs, XRRGetScreenResourcesCurrent returns a fantom monitor at last position
|
||||
{
|
||||
int i = res->ncrtc - 1;
|
||||
XRRCrtcInfo *crtc_info = XRRGetCrtcInfo(server.dsp, res, res->crtcs[i]);
|
||||
XRRCrtcInfo *crtc_info = XRRGetCrtcInfo(server.display, res, res->crtcs[i]);
|
||||
if (!(crtc_info->x || crtc_info->y || crtc_info->width || crtc_info->height)) {
|
||||
res->ncrtc -= 1;
|
||||
}
|
||||
|
@ -322,14 +322,14 @@ void get_monitors()
|
|||
printf("xRandr: Found crtc's: %d\n", res->ncrtc);
|
||||
server.monitors = calloc(res->ncrtc, sizeof(Monitor));
|
||||
for (int i = 0; i < res->ncrtc; ++i) {
|
||||
XRRCrtcInfo *crtc_info = XRRGetCrtcInfo(server.dsp, res, res->crtcs[i]);
|
||||
XRRCrtcInfo *crtc_info = XRRGetCrtcInfo(server.display, res, res->crtcs[i]);
|
||||
server.monitors[i].x = crtc_info->x;
|
||||
server.monitors[i].y = crtc_info->y;
|
||||
server.monitors[i].width = crtc_info->width;
|
||||
server.monitors[i].height = crtc_info->height;
|
||||
server.monitors[i].names = calloc((crtc_info->noutput + 1), sizeof(gchar *));
|
||||
for (int j = 0; j < crtc_info->noutput; ++j) {
|
||||
XRROutputInfo *output_info = XRRGetOutputInfo(server.dsp, res, crtc_info->outputs[j]);
|
||||
XRROutputInfo *output_info = XRRGetOutputInfo(server.display, res, crtc_info->outputs[j]);
|
||||
printf("xRandr: Linking output %s with crtc %d\n", output_info->name, i);
|
||||
server.monitors[i].names[j] = g_strdup(output_info->name);
|
||||
XRRFreeOutputInfo(output_info);
|
||||
|
@ -380,8 +380,8 @@ void get_monitors()
|
|||
server.num_monitors = 1;
|
||||
server.monitors = calloc(1, sizeof(Monitor));
|
||||
server.monitors[0].x = server.monitors[0].y = 0;
|
||||
server.monitors[0].width = DisplayWidth(server.dsp, server.screen);
|
||||
server.monitors[0].height = DisplayHeight(server.dsp, server.screen);
|
||||
server.monitors[0].width = DisplayWidth(server.display, server.screen);
|
||||
server.monitors[0].height = DisplayHeight(server.display, server.screen);
|
||||
server.monitors[0].names = 0;
|
||||
}
|
||||
}
|
||||
|
@ -544,13 +544,13 @@ void server_init_visual()
|
|||
// inspired by freedesktops fdclock ;)
|
||||
XVisualInfo templ = {.screen = server.screen, .depth = 32, .class = TrueColor};
|
||||
int nvi;
|
||||
XVisualInfo *xvi = XGetVisualInfo(server.dsp, VisualScreenMask | VisualDepthMask | VisualClassMask, &templ, &nvi);
|
||||
XVisualInfo *xvi = XGetVisualInfo(server.display, VisualScreenMask | VisualDepthMask | VisualClassMask, &templ, &nvi);
|
||||
|
||||
Visual *visual = NULL;
|
||||
if (xvi) {
|
||||
XRenderPictFormat *format;
|
||||
for (int i = 0; i < nvi; i++) {
|
||||
format = XRenderFindVisualFormat(server.dsp, xvi[i].visual);
|
||||
format = XRenderFindVisualFormat(server.display, xvi[i].visual);
|
||||
if (format->type == PictTypeDirect && format->direct.alphaMask) {
|
||||
visual = xvi[i].visual;
|
||||
break;
|
||||
|
@ -560,33 +560,33 @@ void server_init_visual()
|
|||
XFree(xvi);
|
||||
|
||||
// check composite manager
|
||||
server.composite_manager = XGetSelectionOwner(server.dsp, server.atom._NET_WM_CM_S0);
|
||||
server.composite_manager = XGetSelectionOwner(server.display, server.atom._NET_WM_CM_S0);
|
||||
if (server.colormap)
|
||||
XFreeColormap(server.dsp, server.colormap);
|
||||
XFreeColormap(server.display, server.colormap);
|
||||
if (server.colormap32)
|
||||
XFreeColormap(server.dsp, server.colormap32);
|
||||
XFreeColormap(server.display, server.colormap32);
|
||||
|
||||
if (visual) {
|
||||
server.visual32 = visual;
|
||||
server.colormap32 = XCreateColormap(server.dsp, server.root_win, visual, AllocNone);
|
||||
server.colormap32 = XCreateColormap(server.display, server.root_win, visual, AllocNone);
|
||||
}
|
||||
|
||||
if (!server.disable_transparency && visual && server.composite_manager != None && !snapshot_path) {
|
||||
XSetWindowAttributes attrs;
|
||||
attrs.event_mask = StructureNotifyMask;
|
||||
XChangeWindowAttributes(server.dsp, server.composite_manager, CWEventMask, &attrs);
|
||||
XChangeWindowAttributes(server.display, server.composite_manager, CWEventMask, &attrs);
|
||||
|
||||
server.real_transparency = TRUE;
|
||||
server.depth = 32;
|
||||
printf("real transparency on... depth: %d\n", server.depth);
|
||||
server.colormap = XCreateColormap(server.dsp, server.root_win, visual, AllocNone);
|
||||
server.colormap = XCreateColormap(server.display, server.root_win, visual, AllocNone);
|
||||
server.visual = visual;
|
||||
} else {
|
||||
// no composite manager or snapshot mode => fake transparency
|
||||
server.real_transparency = FALSE;
|
||||
server.depth = DefaultDepth(server.dsp, server.screen);
|
||||
server.depth = DefaultDepth(server.display, server.screen);
|
||||
printf("real transparency off.... depth: %d\n", server.depth);
|
||||
server.colormap = DefaultColormap(server.dsp, server.screen);
|
||||
server.visual = DefaultVisual(server.dsp, server.screen);
|
||||
server.colormap = DefaultColormap(server.display, server.screen);
|
||||
server.visual = DefaultVisual(server.display, server.screen);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ typedef struct Viewport {
|
|||
} Viewport;
|
||||
|
||||
typedef struct Server {
|
||||
Display *dsp;
|
||||
Display *display;
|
||||
Window root_win;
|
||||
Window composite_manager;
|
||||
gboolean real_transparency;
|
||||
|
@ -136,7 +136,7 @@ typedef struct Server {
|
|||
Colormap colormap32;
|
||||
Global_atom atom;
|
||||
#ifdef HAVE_SN
|
||||
SnDisplay *sn_dsp;
|
||||
SnDisplay *sn_display;
|
||||
GTree *pids;
|
||||
#endif // HAVE_SN
|
||||
} Server;
|
||||
|
|
|
@ -87,7 +87,7 @@ void cleanup_systray()
|
|||
systray.area.on_screen = FALSE;
|
||||
free_area(&systray.area);
|
||||
if (render_background) {
|
||||
XFreePixmap(server.dsp, render_background);
|
||||
XFreePixmap(server.display, render_background);
|
||||
render_background = 0;
|
||||
}
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ gboolean resize_systray(void *obj)
|
|||
|
||||
if (systray.icon_size > 0) {
|
||||
long icon_size = systray.icon_size;
|
||||
XChangeProperty(server.dsp,
|
||||
XChangeProperty(server.display,
|
||||
net_sel_win,
|
||||
server.atom._NET_SYSTEM_TRAY_ICON_SIZE,
|
||||
XA_CARDINAL,
|
||||
|
@ -192,10 +192,10 @@ void draw_systray(void *obj, cairo_t *c)
|
|||
fprintf(stderr, BLUE "[%f] %s:%d\n" RESET, profiling_get_time(), __FUNCTION__, __LINE__);
|
||||
if (systray_composited) {
|
||||
if (render_background)
|
||||
XFreePixmap(server.dsp, render_background);
|
||||
XFreePixmap(server.display, render_background);
|
||||
render_background =
|
||||
XCreatePixmap(server.dsp, server.root_win, systray.area.width, systray.area.height, server.depth);
|
||||
XCopyArea(server.dsp,
|
||||
XCreatePixmap(server.display, server.root_win, systray.area.width, systray.area.height, server.depth);
|
||||
XCopyArea(server.display,
|
||||
systray.area.pix,
|
||||
render_background,
|
||||
server.gc,
|
||||
|
@ -274,20 +274,20 @@ void on_change_systray(void *obj)
|
|||
int xpos, ypos;
|
||||
unsigned int width, height, depth;
|
||||
Window root;
|
||||
if (!XGetGeometry(server.dsp, traywin->parent, &root, &xpos, &ypos, &width, &height, &border_width, &depth)) {
|
||||
if (!XGetGeometry(server.display, traywin->parent, &root, &xpos, &ypos, &width, &height, &border_width, &depth)) {
|
||||
fprintf(stderr, RED "Couldn't get geometry of window!\n" RESET);
|
||||
}
|
||||
if (width != traywin->width || height != traywin->height || xpos != traywin->x || ypos != traywin->y) {
|
||||
if (systray_profile)
|
||||
fprintf(stderr,
|
||||
"XMoveResizeWindow(server.dsp, traywin->parent = %ld, traywin->x = %d, traywin->y = %d, "
|
||||
"XMoveResizeWindow(server.display, traywin->parent = %ld, traywin->x = %d, traywin->y = %d, "
|
||||
"traywin->width = %d, traywin->height = %d)\n",
|
||||
traywin->parent,
|
||||
traywin->x,
|
||||
traywin->y,
|
||||
traywin->width,
|
||||
traywin->height);
|
||||
XMoveResizeWindow(server.dsp, traywin->parent, traywin->x, traywin->y, traywin->width, traywin->height);
|
||||
XMoveResizeWindow(server.display, traywin->parent, traywin->x, traywin->y, traywin->width, traywin->height);
|
||||
}
|
||||
if (!traywin->reparented)
|
||||
reparent_icon(traywin);
|
||||
|
@ -312,7 +312,7 @@ void start_net()
|
|||
return;
|
||||
}
|
||||
|
||||
Window win = XGetSelectionOwner(server.dsp, server.atom._NET_SYSTEM_TRAY_SCREEN);
|
||||
Window win = XGetSelectionOwner(server.display, server.atom._NET_SYSTEM_TRAY_SCREEN);
|
||||
|
||||
// freedesktop systray specification
|
||||
if (win != None) {
|
||||
|
@ -324,8 +324,8 @@ void start_net()
|
|||
unsigned char *prop = 0;
|
||||
int pid;
|
||||
|
||||
_NET_WM_PID = XInternAtom(server.dsp, "_NET_WM_PID", True);
|
||||
int ret = XGetWindowProperty(server.dsp,
|
||||
_NET_WM_PID = XInternAtom(server.display, "_NET_WM_PID", True);
|
||||
int ret = XGetWindowProperty(server.display,
|
||||
win,
|
||||
_NET_WM_PID,
|
||||
0,
|
||||
|
@ -349,13 +349,13 @@ void start_net()
|
|||
}
|
||||
|
||||
// init systray protocol
|
||||
net_sel_win = XCreateSimpleWindow(server.dsp, server.root_win, -1, -1, 1, 1, 0, 0, 0);
|
||||
net_sel_win = XCreateSimpleWindow(server.display, server.root_win, -1, -1, 1, 1, 0, 0, 0);
|
||||
fprintf(stderr, "systray window %ld\n", net_sel_win);
|
||||
|
||||
// v0.3 trayer specification. tint2 always horizontal.
|
||||
// Vertical panel will draw the systray horizontal.
|
||||
long orientation = 0;
|
||||
XChangeProperty(server.dsp,
|
||||
XChangeProperty(server.display,
|
||||
net_sel_win,
|
||||
server.atom._NET_SYSTEM_TRAY_ORIENTATION,
|
||||
XA_CARDINAL,
|
||||
|
@ -365,7 +365,7 @@ void start_net()
|
|||
1);
|
||||
if (systray.icon_size > 0) {
|
||||
long icon_size = systray.icon_size;
|
||||
XChangeProperty(server.dsp,
|
||||
XChangeProperty(server.display,
|
||||
net_sel_win,
|
||||
server.atom._NET_SYSTEM_TRAY_ICON_SIZE,
|
||||
XA_CARDINAL,
|
||||
|
@ -375,7 +375,7 @@ void start_net()
|
|||
1);
|
||||
}
|
||||
long padding = 0;
|
||||
XChangeProperty(server.dsp,
|
||||
XChangeProperty(server.display,
|
||||
net_sel_win,
|
||||
server.atom._NET_SYSTEM_TRAY_PADDING,
|
||||
XA_CARDINAL,
|
||||
|
@ -389,17 +389,17 @@ void start_net()
|
|||
vid = XVisualIDFromVisual(server.visual32);
|
||||
else
|
||||
vid = XVisualIDFromVisual(server.visual);
|
||||
XChangeProperty(server.dsp,
|
||||
XChangeProperty(server.display,
|
||||
net_sel_win,
|
||||
XInternAtom(server.dsp, "_NET_SYSTEM_TRAY_VISUAL", False),
|
||||
XInternAtom(server.display, "_NET_SYSTEM_TRAY_VISUAL", False),
|
||||
XA_VISUALID,
|
||||
32,
|
||||
PropModeReplace,
|
||||
(unsigned char *)&vid,
|
||||
1);
|
||||
|
||||
XSetSelectionOwner(server.dsp, server.atom._NET_SYSTEM_TRAY_SCREEN, net_sel_win, CurrentTime);
|
||||
if (XGetSelectionOwner(server.dsp, server.atom._NET_SYSTEM_TRAY_SCREEN) != net_sel_win) {
|
||||
XSetSelectionOwner(server.display, server.atom._NET_SYSTEM_TRAY_SCREEN, net_sel_win, CurrentTime);
|
||||
if (XGetSelectionOwner(server.display, server.atom._NET_SYSTEM_TRAY_SCREEN) != net_sel_win) {
|
||||
stop_net();
|
||||
fprintf(stderr, RED "tint2 : can't get systray manager\n" RESET);
|
||||
return;
|
||||
|
@ -418,7 +418,7 @@ void start_net()
|
|||
ev.data.l[2] = net_sel_win;
|
||||
ev.data.l[3] = 0;
|
||||
ev.data.l[4] = 0;
|
||||
XSendEvent(server.dsp, server.root_win, False, StructureNotifyMask, (XEvent *)&ev);
|
||||
XSendEvent(server.display, server.root_win, False, StructureNotifyMask, (XEvent *)&ev);
|
||||
}
|
||||
|
||||
void net_message(XClientMessageEvent *e)
|
||||
|
@ -463,7 +463,7 @@ void stop_net()
|
|||
}
|
||||
|
||||
if (net_sel_win != None) {
|
||||
XDestroyWindow(server.dsp, net_sel_win);
|
||||
XDestroyWindow(server.display, net_sel_win);
|
||||
net_sel_win = None;
|
||||
}
|
||||
}
|
||||
|
@ -509,7 +509,7 @@ gboolean add_icon(Window win)
|
|||
{
|
||||
XTextProperty xname;
|
||||
char *name;
|
||||
if (XGetWMName(server.dsp, win, &xname)) {
|
||||
if (XGetWMName(server.display, win, &xname)) {
|
||||
name = strdup((char *)xname.value);
|
||||
XFree(xname.value);
|
||||
} else {
|
||||
|
@ -529,7 +529,7 @@ gboolean add_icon(Window win)
|
|||
unsigned long nitems;
|
||||
unsigned long bytes_after;
|
||||
unsigned char *prop = 0;
|
||||
int ret = XGetWindowProperty(server.dsp,
|
||||
int ret = XGetWindowProperty(server.display,
|
||||
win,
|
||||
server.atom._NET_WM_PID,
|
||||
0,
|
||||
|
@ -632,8 +632,8 @@ gboolean add_icon(Window win)
|
|||
// Create the parent window that will embed the icon
|
||||
XWindowAttributes attr;
|
||||
if (systray_profile)
|
||||
fprintf(stderr, "XGetWindowAttributes(server.dsp, win = %ld, &attr)\n", win);
|
||||
if (XGetWindowAttributes(server.dsp, win, &attr) == False) {
|
||||
fprintf(stderr, "XGetWindowAttributes(server.display, win = %ld, &attr)\n", win);
|
||||
if (XGetWindowAttributes(server.display, win, &attr) == False) {
|
||||
free(name);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -673,7 +673,7 @@ gboolean add_icon(Window win)
|
|||
}
|
||||
if (systray_profile)
|
||||
fprintf(stderr, "XCreateWindow(...)\n");
|
||||
Window parent = XCreateWindow(server.dsp,
|
||||
Window parent = XCreateWindow(server.display,
|
||||
panel->main_win,
|
||||
0,
|
||||
0,
|
||||
|
@ -710,8 +710,8 @@ gboolean add_icon(Window win)
|
|||
|
||||
if (!traywin->hide && !panel->is_hidden) {
|
||||
if (systray_profile)
|
||||
fprintf(stderr, "XMapRaised(server.dsp, traywin->parent)\n");
|
||||
XMapRaised(server.dsp, traywin->parent);
|
||||
fprintf(stderr, "XMapRaised(server.display, traywin->parent)\n");
|
||||
XMapRaised(server.display, traywin->parent);
|
||||
}
|
||||
|
||||
if (systray_profile)
|
||||
|
@ -742,22 +742,22 @@ gboolean reparent_icon(TrayWindow *traywin)
|
|||
return TRUE;
|
||||
|
||||
// Watch for the icon trying to resize itself / closing again
|
||||
XSync(server.dsp, False);
|
||||
XSync(server.display, False);
|
||||
error = FALSE;
|
||||
XErrorHandler old = XSetErrorHandler(window_error_handler);
|
||||
if (systray_profile)
|
||||
fprintf(stderr, "XSelectInput(server.dsp, traywin->win, ...)\n");
|
||||
XSelectInput(server.dsp, traywin->win, StructureNotifyMask | PropertyChangeMask | ResizeRedirectMask);
|
||||
XWithdrawWindow(server.dsp, traywin->win, server.screen);
|
||||
XReparentWindow(server.dsp, traywin->win, traywin->parent, 0, 0);
|
||||
fprintf(stderr, "XSelectInput(server.display, traywin->win, ...)\n");
|
||||
XSelectInput(server.display, traywin->win, StructureNotifyMask | PropertyChangeMask | ResizeRedirectMask);
|
||||
XWithdrawWindow(server.display, traywin->win, server.screen);
|
||||
XReparentWindow(server.display, traywin->win, traywin->parent, 0, 0);
|
||||
|
||||
if (systray_profile)
|
||||
fprintf(stderr,
|
||||
"XMoveResizeWindow(server.dsp, traywin->win = %ld, 0, 0, traywin->width = %d, traywin->height = %d)\n",
|
||||
"XMoveResizeWindow(server.display, traywin->win = %ld, 0, 0, traywin->width = %d, traywin->height = %d)\n",
|
||||
traywin->win,
|
||||
traywin->width,
|
||||
traywin->height);
|
||||
XMoveResizeWindow(server.dsp, traywin->win, 0, 0, traywin->width, traywin->height);
|
||||
XMoveResizeWindow(server.display, traywin->win, 0, 0, traywin->width, traywin->height);
|
||||
|
||||
// Embed into parent
|
||||
{
|
||||
|
@ -774,11 +774,11 @@ gboolean reparent_icon(TrayWindow *traywin)
|
|||
e.xclient.data.l[3] = traywin->parent;
|
||||
e.xclient.data.l[4] = 0;
|
||||
if (systray_profile)
|
||||
fprintf(stderr, "XSendEvent(server.dsp, traywin->win, False, NoEventMask, &e)\n");
|
||||
XSendEvent(server.dsp, traywin->win, False, NoEventMask, &e);
|
||||
fprintf(stderr, "XSendEvent(server.display, traywin->win, False, NoEventMask, &e)\n");
|
||||
XSendEvent(server.display, traywin->win, False, NoEventMask, &e);
|
||||
}
|
||||
|
||||
XSync(server.dsp, False);
|
||||
XSync(server.display, False);
|
||||
XSetErrorHandler(old);
|
||||
if (error != FALSE) {
|
||||
fprintf(stderr,
|
||||
|
@ -821,7 +821,7 @@ gboolean embed_icon(TrayWindow *traywin)
|
|||
|
||||
Panel *panel = systray.area.panel;
|
||||
|
||||
XSync(server.dsp, False);
|
||||
XSync(server.display, False);
|
||||
error = FALSE;
|
||||
XErrorHandler old = XSetErrorHandler(window_error_handler);
|
||||
|
||||
|
@ -834,9 +834,9 @@ gboolean embed_icon(TrayWindow *traywin)
|
|||
|
||||
if (systray_profile)
|
||||
fprintf(stderr,
|
||||
"XGetWindowProperty(server.dsp, traywin->win, server.atom._XEMBED_INFO, 0, 2, False, "
|
||||
"XGetWindowProperty(server.display, traywin->win, server.atom._XEMBED_INFO, 0, 2, False, "
|
||||
"server.atom._XEMBED_INFO, &acttype, &actfmt, &nbitem, &bytes, &data)\n");
|
||||
ret = XGetWindowProperty(server.dsp,
|
||||
ret = XGetWindowProperty(server.display,
|
||||
traywin->win,
|
||||
server.atom._XEMBED_INFO,
|
||||
0,
|
||||
|
@ -879,30 +879,30 @@ gboolean embed_icon(TrayWindow *traywin)
|
|||
// Redirect rendering when using compositing
|
||||
if (systray_composited) {
|
||||
if (systray_profile)
|
||||
fprintf(stderr, "XDamageCreate(server.dsp, traywin->parent, XDamageReportRawRectangles)\n");
|
||||
traywin->damage = XDamageCreate(server.dsp, traywin->parent, XDamageReportRawRectangles);
|
||||
fprintf(stderr, "XDamageCreate(server.display, traywin->parent, XDamageReportRawRectangles)\n");
|
||||
traywin->damage = XDamageCreate(server.display, traywin->parent, XDamageReportRawRectangles);
|
||||
if (systray_profile)
|
||||
fprintf(stderr, "XCompositeRedirectWindow(server.dsp, traywin->parent, CompositeRedirectManual)\n");
|
||||
XCompositeRedirectWindow(server.dsp, traywin->parent, CompositeRedirectManual);
|
||||
fprintf(stderr, "XCompositeRedirectWindow(server.display, traywin->parent, CompositeRedirectManual)\n");
|
||||
XCompositeRedirectWindow(server.display, traywin->parent, CompositeRedirectManual);
|
||||
}
|
||||
|
||||
XRaiseWindow(server.dsp, traywin->win);
|
||||
XRaiseWindow(server.display, traywin->win);
|
||||
|
||||
// Make the icon visible
|
||||
if (!traywin->hide) {
|
||||
if (systray_profile)
|
||||
fprintf(stderr, "XMapWindow(server.dsp, traywin->win)\n");
|
||||
XMapWindow(server.dsp, traywin->win);
|
||||
fprintf(stderr, "XMapWindow(server.display, traywin->win)\n");
|
||||
XMapWindow(server.display, traywin->win);
|
||||
}
|
||||
if (!traywin->hide && !panel->is_hidden) {
|
||||
if (systray_profile)
|
||||
fprintf(stderr, "XMapRaised(server.dsp, traywin->parent)\n");
|
||||
XMapRaised(server.dsp, traywin->parent);
|
||||
fprintf(stderr, "XMapRaised(server.display, traywin->parent)\n");
|
||||
XMapRaised(server.display, traywin->parent);
|
||||
}
|
||||
|
||||
if (systray_profile)
|
||||
fprintf(stderr, "XSync(server.dsp, False)\n");
|
||||
XSync(server.dsp, False);
|
||||
fprintf(stderr, "XSync(server.display, False)\n");
|
||||
XSync(server.display, False);
|
||||
XSetErrorHandler(old);
|
||||
if (error != FALSE) {
|
||||
fprintf(stderr,
|
||||
|
@ -946,19 +946,19 @@ void remove_icon(TrayWindow *traywin)
|
|||
systray.list_icons = g_slist_remove(systray.list_icons, traywin);
|
||||
fprintf(stderr, YELLOW "remove_icon: %lu (%s)\n" RESET, traywin->win, traywin->name);
|
||||
|
||||
XSelectInput(server.dsp, traywin->win, NoEventMask);
|
||||
XSelectInput(server.display, traywin->win, NoEventMask);
|
||||
if (traywin->damage)
|
||||
XDamageDestroy(server.dsp, traywin->damage);
|
||||
XDamageDestroy(server.display, traywin->damage);
|
||||
|
||||
// reparent to root
|
||||
XSync(server.dsp, False);
|
||||
XSync(server.display, False);
|
||||
error = FALSE;
|
||||
XErrorHandler old = XSetErrorHandler(window_error_handler);
|
||||
if (!traywin->hide)
|
||||
XUnmapWindow(server.dsp, traywin->win);
|
||||
XReparentWindow(server.dsp, traywin->win, server.root_win, 0, 0);
|
||||
XDestroyWindow(server.dsp, traywin->parent);
|
||||
XSync(server.dsp, False);
|
||||
XUnmapWindow(server.display, traywin->win);
|
||||
XReparentWindow(server.display, traywin->win, server.root_win, 0, 0);
|
||||
XDestroyWindow(server.display, traywin->parent);
|
||||
XSync(server.display, False);
|
||||
XSetErrorHandler(old);
|
||||
stop_timeout(traywin->render_timeout);
|
||||
stop_timeout(traywin->resize_timeout);
|
||||
|
@ -1000,26 +1000,26 @@ void systray_resize_icon(void *t)
|
|||
int xpos, ypos;
|
||||
unsigned int width, height, depth;
|
||||
Window root;
|
||||
if (!XGetGeometry(server.dsp, traywin->win, &root, &xpos, &ypos, &width, &height, &border_width, &depth)) {
|
||||
if (!XGetGeometry(server.display, traywin->win, &root, &xpos, &ypos, &width, &height, &border_width, &depth)) {
|
||||
return;
|
||||
} else {
|
||||
if (1 || xpos != 0 || ypos != 0 || width != traywin->width || height != traywin->height) {
|
||||
if (systray_profile)
|
||||
fprintf(stderr,
|
||||
"XMoveResizeWindow(server.dsp, traywin->win = %ld, 0, 0, traywin->width = %d, traywin->height "
|
||||
"XMoveResizeWindow(server.display, traywin->win = %ld, 0, 0, traywin->width = %d, traywin->height "
|
||||
"= %d)\n",
|
||||
traywin->win,
|
||||
traywin->width,
|
||||
traywin->height);
|
||||
if (0) {
|
||||
XMoveResizeWindow(server.dsp, traywin->win, 0, 0, traywin->width, traywin->height);
|
||||
XMoveResizeWindow(server.display, traywin->win, 0, 0, traywin->width, traywin->height);
|
||||
}
|
||||
if (0) {
|
||||
XWindowChanges changes;
|
||||
changes.x = changes.y = 0;
|
||||
changes.width = traywin->width;
|
||||
changes.height = traywin->height;
|
||||
XConfigureWindow(server.dsp, traywin->win, CWX | CWY | CWWidth | CWHeight, &changes);
|
||||
XConfigureWindow(server.display, traywin->win, CWX | CWY | CWWidth | CWHeight, &changes);
|
||||
}
|
||||
if (1) {
|
||||
XConfigureEvent ev;
|
||||
|
@ -1035,9 +1035,9 @@ void systray_resize_icon(void *t)
|
|||
ev.border_width = 0;
|
||||
ev.above = None;
|
||||
ev.override_redirect = False;
|
||||
XSendEvent(server.dsp, traywin->win, False, StructureNotifyMask, (XEvent *)&ev);
|
||||
XSendEvent(server.display, traywin->win, False, StructureNotifyMask, (XEvent *)&ev);
|
||||
}
|
||||
XSync(server.dsp, False);
|
||||
XSync(server.display, False);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1260,48 +1260,48 @@ void systray_render_icon_composited(void *t)
|
|||
// Very ugly hack, but somehow imlib2 is not able to get the image from the traywindow itself,
|
||||
// so we first render the tray window onto a pixmap, and then we tell imlib2 to use this pixmap as
|
||||
// drawable. If someone knows why it does not work with the traywindow itself, please tell me ;)
|
||||
Pixmap tmp_pmap = XCreatePixmap(server.dsp, traywin->win, traywin->width, traywin->height, 32);
|
||||
Pixmap tmp_pmap = XCreatePixmap(server.display, traywin->win, traywin->width, traywin->height, 32);
|
||||
if (!tmp_pmap) {
|
||||
goto on_systray_error;
|
||||
}
|
||||
XRenderPictFormat *f;
|
||||
if (traywin->depth == 24) {
|
||||
f = XRenderFindStandardFormat(server.dsp, PictStandardRGB24);
|
||||
f = XRenderFindStandardFormat(server.display, PictStandardRGB24);
|
||||
} else if (traywin->depth == 32) {
|
||||
f = XRenderFindStandardFormat(server.dsp, PictStandardARGB32);
|
||||
f = XRenderFindStandardFormat(server.display, PictStandardARGB32);
|
||||
} else {
|
||||
fprintf(stderr, RED "Strange tray icon found with depth: %d\n" RESET, traywin->depth);
|
||||
XFreePixmap(server.dsp, tmp_pmap);
|
||||
XFreePixmap(server.display, tmp_pmap);
|
||||
return;
|
||||
}
|
||||
XRenderPictFormat *f32 = XRenderFindVisualFormat(server.dsp, server.visual32);
|
||||
XRenderPictFormat *f32 = XRenderFindVisualFormat(server.display, server.visual32);
|
||||
if (!f || !f32) {
|
||||
XFreePixmap(server.dsp, tmp_pmap);
|
||||
XFreePixmap(server.display, tmp_pmap);
|
||||
goto on_systray_error;
|
||||
}
|
||||
|
||||
XSync(server.dsp, False);
|
||||
XSync(server.display, False);
|
||||
error = FALSE;
|
||||
XErrorHandler old = XSetErrorHandler(window_error_handler);
|
||||
|
||||
// if (server.real_transparency)
|
||||
// Picture pict_image = XRenderCreatePicture(server.dsp, traywin->parent, f, 0, 0);
|
||||
// Picture pict_image = XRenderCreatePicture(server.display, traywin->parent, f, 0, 0);
|
||||
// reverted Rev 407 because here it's breaking alls icon with systray + xcompmgr
|
||||
Picture pict_image = XRenderCreatePicture(server.dsp, traywin->win, f, 0, 0);
|
||||
Picture pict_image = XRenderCreatePicture(server.display, traywin->win, f, 0, 0);
|
||||
if (!pict_image) {
|
||||
XFreePixmap(server.dsp, tmp_pmap);
|
||||
XFreePixmap(server.display, tmp_pmap);
|
||||
XSetErrorHandler(old);
|
||||
goto on_error;
|
||||
}
|
||||
Picture pict_drawable =
|
||||
XRenderCreatePicture(server.dsp, tmp_pmap, XRenderFindVisualFormat(server.dsp, server.visual32), 0, 0);
|
||||
XRenderCreatePicture(server.display, tmp_pmap, XRenderFindVisualFormat(server.display, server.visual32), 0, 0);
|
||||
if (!pict_drawable) {
|
||||
XRenderFreePicture(server.dsp, pict_image);
|
||||
XFreePixmap(server.dsp, tmp_pmap);
|
||||
XRenderFreePicture(server.display, pict_image);
|
||||
XFreePixmap(server.display, tmp_pmap);
|
||||
XSetErrorHandler(old);
|
||||
goto on_error;
|
||||
}
|
||||
XRenderComposite(server.dsp,
|
||||
XRenderComposite(server.display,
|
||||
PictOpSrc,
|
||||
pict_image,
|
||||
None,
|
||||
|
@ -1314,8 +1314,8 @@ void systray_render_icon_composited(void *t)
|
|||
0,
|
||||
traywin->width,
|
||||
traywin->height);
|
||||
XRenderFreePicture(server.dsp, pict_image);
|
||||
XRenderFreePicture(server.dsp, pict_drawable);
|
||||
XRenderFreePicture(server.display, pict_image);
|
||||
XRenderFreePicture(server.display, pict_drawable);
|
||||
// end of the ugly hack and we can continue as before
|
||||
|
||||
imlib_context_set_visual(server.visual32);
|
||||
|
@ -1324,7 +1324,7 @@ void systray_render_icon_composited(void *t)
|
|||
Imlib_Image image = imlib_create_image_from_drawable(0, 0, 0, traywin->width, traywin->height, 1);
|
||||
imlib_context_set_visual(server.visual);
|
||||
imlib_context_set_colormap(server.colormap);
|
||||
XFreePixmap(server.dsp, tmp_pmap);
|
||||
XFreePixmap(server.display, tmp_pmap);
|
||||
if (!image) {
|
||||
imlib_context_set_visual(server.visual);
|
||||
imlib_context_set_colormap(server.colormap);
|
||||
|
@ -1360,8 +1360,8 @@ void systray_render_icon_composited(void *t)
|
|||
systray_render_icon_from_image(traywin);
|
||||
|
||||
if (traywin->damage)
|
||||
XDamageSubtract(server.dsp, traywin->damage, None, None);
|
||||
XSync(server.dsp, False);
|
||||
XDamageSubtract(server.display, traywin->damage, None, None);
|
||||
XSync(server.display, False);
|
||||
XSetErrorHandler(old);
|
||||
|
||||
if (error)
|
||||
|
@ -1446,7 +1446,7 @@ void systray_render_icon(void *t)
|
|||
}
|
||||
|
||||
if (systray_composited) {
|
||||
XSync(server.dsp, False);
|
||||
XSync(server.display, False);
|
||||
error = FALSE;
|
||||
XErrorHandler old = XSetErrorHandler(window_error_handler);
|
||||
|
||||
|
@ -1454,7 +1454,7 @@ void systray_render_icon(void *t)
|
|||
int xpos, ypos;
|
||||
unsigned int width, height, depth;
|
||||
Window root;
|
||||
if (!XGetGeometry(server.dsp, traywin->win, &root, &xpos, &ypos, &width, &height, &border_width, &depth)) {
|
||||
if (!XGetGeometry(server.display, traywin->win, &root, &xpos, &ypos, &width, &height, &border_width, &depth)) {
|
||||
stop_timeout(traywin->render_timeout);
|
||||
if (!traywin->resize_timeout)
|
||||
traywin->render_timeout =
|
||||
|
@ -1493,14 +1493,14 @@ void systray_render_icon(void *t)
|
|||
// Trigger window repaint
|
||||
if (systray_profile)
|
||||
fprintf(stderr,
|
||||
"XClearArea(server.dsp, traywin->parent = %ld, 0, 0, traywin->width, traywin->height, True)\n",
|
||||
"XClearArea(server.display, traywin->parent = %ld, 0, 0, traywin->width, traywin->height, True)\n",
|
||||
traywin->parent);
|
||||
XClearArea(server.dsp, traywin->parent, 0, 0, 0, 0, True);
|
||||
XClearArea(server.display, traywin->parent, 0, 0, 0, 0, True);
|
||||
if (systray_profile)
|
||||
fprintf(stderr,
|
||||
"XClearArea(server.dsp, traywin->win = %ld, 0, 0, traywin->width, traywin->height, True)\n",
|
||||
"XClearArea(server.display, traywin->win = %ld, 0, 0, traywin->width, traywin->height, True)\n",
|
||||
traywin->win);
|
||||
XClearArea(server.dsp, traywin->win, 0, 0, 0, 0, True);
|
||||
XClearArea(server.display, traywin->win, 0, 0, 0, 0, True);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -53,8 +53,8 @@ Task *add_task(Window win)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
XSelectInput(server.dsp, win, PropertyChangeMask | StructureNotifyMask);
|
||||
XFlush(server.dsp);
|
||||
XSelectInput(server.display, win, PropertyChangeMask | StructureNotifyMask);
|
||||
XFlush(server.display);
|
||||
|
||||
int monitor = 0;
|
||||
if (num_panels > 1) {
|
||||
|
@ -180,7 +180,7 @@ void remove_task(Task *task)
|
|||
task->icon_press[k] = 0;
|
||||
}
|
||||
if (task->state_pix[k])
|
||||
XFreePixmap(server.dsp, task->state_pix[k]);
|
||||
XFreePixmap(server.display, task->state_pix[k]);
|
||||
}
|
||||
|
||||
GPtrArray *task_group = g_hash_table_lookup(win_to_task, &win);
|
||||
|
@ -281,7 +281,7 @@ void get_icon(Task *task)
|
|||
#endif
|
||||
} else {
|
||||
// get Pixmap icon
|
||||
hints = XGetWMHints(server.dsp, task->win);
|
||||
hints = XGetWMHints(server.display, task->win);
|
||||
if (hints) {
|
||||
if (hints->flags & IconPixmapHint && hints->icon_pixmap != 0) {
|
||||
// get width, height and depth for the pixmap
|
||||
|
@ -291,7 +291,7 @@ void get_icon(Task *task)
|
|||
uint w, h;
|
||||
|
||||
// printf(" get pixmap\n");
|
||||
XGetGeometry(server.dsp, hints->icon_pixmap, &root, &icon_x, &icon_y, &w, &h, &border_width, &bpp);
|
||||
XGetGeometry(server.display, hints->icon_pixmap, &root, &icon_x, &icon_y, &w, &h, &border_width, &bpp);
|
||||
imlib_context_set_drawable(hints->icon_pixmap);
|
||||
img = imlib_create_image_from_drawable(hints->icon_mask, 0, 0, w, h, 0);
|
||||
}
|
||||
|
@ -446,7 +446,7 @@ void on_change_task(void *obj)
|
|||
Panel *panel = (Panel *)task->area.panel;
|
||||
|
||||
long value[] = {panel->posx + task->area.posx, panel->posy + task->area.posy, task->area.width, task->area.height};
|
||||
XChangeProperty(server.dsp,
|
||||
XChangeProperty(server.display,
|
||||
task->win,
|
||||
server.atom._NET_WM_ICON_GEOMETRY,
|
||||
XA_CARDINAL,
|
||||
|
@ -540,7 +540,7 @@ void reset_active_task()
|
|||
if (w1) {
|
||||
if (!task_get_tasks(w1)) {
|
||||
Window w2;
|
||||
while (XGetTransientForHint(server.dsp, w1, &w2))
|
||||
while (XGetTransientForHint(server.display, w1, &w2))
|
||||
w1 = w2;
|
||||
}
|
||||
set_task_state((active_task = task_get_task(w1)), TASK_ACTIVE);
|
||||
|
@ -617,7 +617,7 @@ void set_task_redraw(Task *task)
|
|||
{
|
||||
for (int k = 0; k < TASK_STATE_COUNT; ++k) {
|
||||
if (task->state_pix[k])
|
||||
XFreePixmap(server.dsp, task->state_pix[k]);
|
||||
XFreePixmap(server.display, task->state_pix[k]);
|
||||
task->state_pix[k] = 0;
|
||||
}
|
||||
task->area.pix = 0;
|
||||
|
|
|
@ -101,7 +101,7 @@ void cleanup_taskbar()
|
|||
Taskbar *taskbar = &panel->taskbar[j];
|
||||
for (int k = 0; k < TASKBAR_STATE_COUNT; ++k) {
|
||||
if (taskbar->state_pix[k])
|
||||
XFreePixmap(server.dsp, taskbar->state_pix[k]);
|
||||
XFreePixmap(server.display, taskbar->state_pix[k]);
|
||||
taskbar->state_pix[k] = 0;
|
||||
}
|
||||
free_area(&taskbar->area);
|
||||
|
@ -425,7 +425,7 @@ void on_change_taskbar(void *obj)
|
|||
// reset Pixmap when position/size changed
|
||||
for (int k = 0; k < TASKBAR_STATE_COUNT; ++k) {
|
||||
if (taskbar->state_pix[k])
|
||||
XFreePixmap(server.dsp, taskbar->state_pix[k]);
|
||||
XFreePixmap(server.display, taskbar->state_pix[k]);
|
||||
taskbar->state_pix[k] = 0;
|
||||
}
|
||||
taskbar->area.pix = 0;
|
||||
|
|
|
@ -127,7 +127,7 @@ void cleanup_taskbarname()
|
|||
free_area(&taskbar->bar_name.area);
|
||||
for (k = 0; k < TASKBAR_STATE_COUNT; ++k) {
|
||||
if (taskbar->bar_name.state_pix[k])
|
||||
XFreePixmap(server.dsp, taskbar->bar_name.state_pix[k]);
|
||||
XFreePixmap(server.display, taskbar->bar_name.state_pix[k]);
|
||||
taskbar->bar_name.state_pix[k] = 0;
|
||||
}
|
||||
remove_area((Area *)&taskbar->bar_name);
|
||||
|
|
138
src/tint.c
138
src/tint.c
|
@ -78,7 +78,7 @@ void detect_compositor(void *arg)
|
|||
}
|
||||
|
||||
// No compositor, check for one
|
||||
if (XGetSelectionOwner(server.dsp, server.atom._NET_WM_CM_S0) != None) {
|
||||
if (XGetSelectionOwner(server.display, server.atom._NET_WM_CM_S0) != None) {
|
||||
stop_timeout(detect_compositor_timer);
|
||||
// Restart tint2
|
||||
fprintf(stderr, "Detected compositor, restarting tint2...\n");
|
||||
|
@ -236,14 +236,14 @@ static void sigchld_handler_async()
|
|||
|
||||
void init_X11_pre_config()
|
||||
{
|
||||
server.dsp = XOpenDisplay(NULL);
|
||||
if (!server.dsp) {
|
||||
server.display = XOpenDisplay(NULL);
|
||||
if (!server.display) {
|
||||
fprintf(stderr, "tint2 exit : could not open display.\n");
|
||||
exit(0);
|
||||
}
|
||||
server_init_atoms();
|
||||
server.screen = DefaultScreen(server.dsp);
|
||||
server.root_win = RootWindow(server.dsp, server.screen);
|
||||
server.screen = DefaultScreen(server.display);
|
||||
server.root_win = RootWindow(server.display, server.screen);
|
||||
server.desktop = get_current_desktop();
|
||||
|
||||
setlocale(LC_ALL, "");
|
||||
|
@ -251,7 +251,7 @@ void init_X11_pre_config()
|
|||
setlocale(LC_NUMERIC, "POSIX");
|
||||
|
||||
/* Catch events */
|
||||
XSelectInput(server.dsp, server.root_win, PropertyChangeMask | StructureNotifyMask);
|
||||
XSelectInput(server.display, server.root_win, PropertyChangeMask | StructureNotifyMask);
|
||||
|
||||
// get monitor and desktop config
|
||||
get_monitors();
|
||||
|
@ -259,7 +259,7 @@ void init_X11_pre_config()
|
|||
|
||||
server.disable_transparency = 0;
|
||||
|
||||
xsettings_client = xsettings_client_new(server.dsp, server.screen, xsettings_notify_cb, NULL, NULL);
|
||||
xsettings_client = xsettings_client_new(server.display, server.screen, xsettings_notify_cb, NULL, NULL);
|
||||
}
|
||||
|
||||
void init_X11_post_config()
|
||||
|
@ -270,7 +270,7 @@ void init_X11_post_config()
|
|||
#ifdef HAVE_SN
|
||||
// Initialize startup-notification
|
||||
if (startup_notifications) {
|
||||
server.sn_dsp = sn_display_new(server.dsp, error_trap_push, error_trap_pop);
|
||||
server.sn_display = sn_display_new(server.display, error_trap_push, error_trap_pop);
|
||||
server.pids = g_tree_new(cmp_ptr);
|
||||
// Setup a handler for child termination
|
||||
if (pipe(sn_pipe) != 0) {
|
||||
|
@ -289,7 +289,7 @@ void init_X11_post_config()
|
|||
}
|
||||
#endif // HAVE_SN
|
||||
|
||||
imlib_context_set_display(server.dsp);
|
||||
imlib_context_set_display(server.display);
|
||||
imlib_context_set_visual(server.visual);
|
||||
imlib_context_set_colormap(server.colormap);
|
||||
|
||||
|
@ -328,9 +328,9 @@ void cleanup()
|
|||
|
||||
cleanup_server();
|
||||
cleanup_timeout();
|
||||
if (server.dsp)
|
||||
XCloseDisplay(server.dsp);
|
||||
server.dsp = NULL;
|
||||
if (server.display)
|
||||
XCloseDisplay(server.display);
|
||||
server.display = NULL;
|
||||
|
||||
#ifdef HAVE_SN
|
||||
if (startup_notifications) {
|
||||
|
@ -352,7 +352,7 @@ void get_snapshot(const char *path)
|
|||
if (panel->area.width > server.monitors[0].width)
|
||||
panel->area.width = server.monitors[0].width;
|
||||
|
||||
panel->temp_pmap = XCreatePixmap(server.dsp, server.root_win, panel->area.width, panel->area.height, server.depth);
|
||||
panel->temp_pmap = XCreatePixmap(server.display, server.root_win, panel->area.width, panel->area.height, server.depth);
|
||||
render_panel(panel);
|
||||
|
||||
Imlib_Image img = NULL;
|
||||
|
@ -383,11 +383,11 @@ void window_action(Task *task, MouseAction action)
|
|||
activate_window(task->win);
|
||||
break;
|
||||
case ICONIFY:
|
||||
XIconifyWindow(server.dsp, task->win, server.screen);
|
||||
XIconifyWindow(server.display, task->win, server.screen);
|
||||
break;
|
||||
case TOGGLE_ICONIFY:
|
||||
if (active_task && task->win == active_task->win)
|
||||
XIconifyWindow(server.dsp, task->win, server.screen);
|
||||
XIconifyWindow(server.display, task->win, server.screen);
|
||||
else
|
||||
activate_window(task->win);
|
||||
break;
|
||||
|
@ -481,15 +481,15 @@ int tint2_handles_click(Panel *panel, XButtonEvent *e)
|
|||
void forward_click(XEvent *e)
|
||||
{
|
||||
// forward the click to the desktop window (thanks conky)
|
||||
XUngrabPointer(server.dsp, e->xbutton.time);
|
||||
XUngrabPointer(server.display, e->xbutton.time);
|
||||
e->xbutton.window = server.root_win;
|
||||
// icewm doesn't open under the mouse.
|
||||
// and xfce doesn't open at all.
|
||||
e->xbutton.x = e->xbutton.x_root;
|
||||
e->xbutton.y = e->xbutton.y_root;
|
||||
// printf("**** %d, %d\n", e->xbutton.x, e->xbutton.y);
|
||||
// XSetInputFocus(server.dsp, e->xbutton.window, RevertToParent, e->xbutton.time);
|
||||
XSendEvent(server.dsp, e->xbutton.window, False, ButtonPressMask, e);
|
||||
// XSetInputFocus(server.display, e->xbutton.window, RevertToParent, e->xbutton.time);
|
||||
XSendEvent(server.display, e->xbutton.window, False, ButtonPressMask, e);
|
||||
}
|
||||
|
||||
void event_button_press(XEvent *e)
|
||||
|
@ -505,7 +505,7 @@ void event_button_press(XEvent *e)
|
|||
task_drag = click_task(panel, e->xbutton.x, e->xbutton.y);
|
||||
|
||||
if (panel_layer == BOTTOM_LAYER)
|
||||
XLowerWindow(server.dsp, panel->main_win);
|
||||
XLowerWindow(server.display, panel->main_win);
|
||||
}
|
||||
|
||||
void event_button_motion_notify(XEvent *e)
|
||||
|
@ -581,7 +581,7 @@ void event_button_release(XEvent *e)
|
|||
if (wm_menu && !tint2_handles_click(panel, &e->xbutton)) {
|
||||
forward_click(e);
|
||||
if (panel_layer == BOTTOM_LAYER)
|
||||
XLowerWindow(server.dsp, panel->main_win);
|
||||
XLowerWindow(server.display, panel->main_win);
|
||||
task_drag = 0;
|
||||
return;
|
||||
}
|
||||
|
@ -614,7 +614,7 @@ void event_button_release(XEvent *e)
|
|||
if (click_clock(panel, e->xbutton.x, e->xbutton.y)) {
|
||||
clock_action(e->xbutton.button);
|
||||
if (panel_layer == BOTTOM_LAYER)
|
||||
XLowerWindow(server.dsp, panel->main_win);
|
||||
XLowerWindow(server.display, panel->main_win);
|
||||
task_drag = 0;
|
||||
return;
|
||||
}
|
||||
|
@ -623,7 +623,7 @@ void event_button_release(XEvent *e)
|
|||
if (click_battery(panel, e->xbutton.x, e->xbutton.y)) {
|
||||
battery_action(e->xbutton.button);
|
||||
if (panel_layer == BOTTOM_LAYER)
|
||||
XLowerWindow(server.dsp, panel->main_win);
|
||||
XLowerWindow(server.display, panel->main_win);
|
||||
task_drag = 0;
|
||||
return;
|
||||
}
|
||||
|
@ -633,7 +633,7 @@ void event_button_release(XEvent *e)
|
|||
if (execp) {
|
||||
execp_action(execp, e->xbutton.button);
|
||||
if (panel_layer == BOTTOM_LAYER)
|
||||
XLowerWindow(server.dsp, panel->main_win);
|
||||
XLowerWindow(server.display, panel->main_win);
|
||||
task_drag = 0;
|
||||
return;
|
||||
}
|
||||
|
@ -651,7 +651,7 @@ void event_button_release(XEvent *e)
|
|||
if (!(taskbar = click_taskbar(panel, e->xbutton.x, e->xbutton.y))) {
|
||||
// TODO: check better solution to keep window below
|
||||
if (panel_layer == BOTTOM_LAYER)
|
||||
XLowerWindow(server.dsp, panel->main_win);
|
||||
XLowerWindow(server.display, panel->main_win);
|
||||
task_drag = 0;
|
||||
return;
|
||||
}
|
||||
|
@ -689,7 +689,7 @@ void event_button_release(XEvent *e)
|
|||
|
||||
// to keep window below
|
||||
if (panel_layer == BOTTOM_LAYER)
|
||||
XLowerWindow(server.dsp, panel->main_win);
|
||||
XLowerWindow(server.display, panel->main_win);
|
||||
}
|
||||
|
||||
void update_desktop_names()
|
||||
|
@ -745,7 +745,7 @@ void event_property_notify(XEvent *e)
|
|||
xsettings_client_process_event(xsettings_client, e);
|
||||
if (win == server.root_win) {
|
||||
if (!server.got_root_win) {
|
||||
XSelectInput(server.dsp, server.root_win, PropertyChangeMask | StructureNotifyMask);
|
||||
XSelectInput(server.display, server.root_win, PropertyChangeMask | StructureNotifyMask);
|
||||
server.got_root_win = TRUE;
|
||||
}
|
||||
|
||||
|
@ -871,7 +871,7 @@ void event_property_notify(XEvent *e)
|
|||
} else {
|
||||
Task *task = task_get_task(win);
|
||||
if (debug) {
|
||||
char *atom_name = XGetAtomName(server.dsp, at);
|
||||
char *atom_name = XGetAtomName(server.display, at);
|
||||
fprintf(stderr, "%s %d: win = %ld, task = %s, atom = %s\n", __FUNCTION__, __LINE__, win, task ? (task->title ? task->title : "??") : "null", atom_name);
|
||||
XFree(atom_name);
|
||||
}
|
||||
|
@ -882,7 +882,7 @@ void event_property_notify(XEvent *e)
|
|||
// xfce4 sends _NET_WM_STATE after minimized to tray, so we need to check if window is mapped
|
||||
// if it is mapped and not set as skip_taskbar, we must add it to our task list
|
||||
XWindowAttributes wa;
|
||||
XGetWindowAttributes(server.dsp, win, &wa);
|
||||
XGetWindowAttributes(server.display, win, &wa);
|
||||
if (wa.map_state == IsViewable && !window_is_skip_taskbar(win)) {
|
||||
if ((task = add_task(win)))
|
||||
panel_refresh = TRUE;
|
||||
|
@ -890,7 +890,7 @@ void event_property_notify(XEvent *e)
|
|||
}
|
||||
return;
|
||||
}
|
||||
// printf("atom root_win = %s, %s\n", XGetAtomName(server.dsp, at), task->title);
|
||||
// printf("atom root_win = %s, %s\n", XGetAtomName(server.display, at), task->title);
|
||||
|
||||
// Window title changed
|
||||
if (at == server.atom._NET_WM_VISIBLE_NAME || at == server.atom._NET_WM_NAME || at == server.atom.WM_NAME) {
|
||||
|
@ -910,7 +910,7 @@ void event_property_notify(XEvent *e)
|
|||
int count;
|
||||
Atom *atom_state = server_get_property(win, server.atom._NET_WM_STATE, XA_ATOM, &count);
|
||||
for (int j = 0; j < count; j++) {
|
||||
char *atom_state_name = XGetAtomName(server.dsp, atom_state[j]);
|
||||
char *atom_state_name = XGetAtomName(server.display, atom_state[j]);
|
||||
fprintf(stderr, "%s %d: _NET_WM_STATE = %s\n", __FUNCTION__, __LINE__, atom_state_name);
|
||||
XFree(atom_state_name);
|
||||
}
|
||||
|
@ -945,7 +945,7 @@ void event_property_notify(XEvent *e)
|
|||
update_task_desktop(task);
|
||||
}
|
||||
} else if (at == server.atom.WM_HINTS) {
|
||||
XWMHints *wmhints = XGetWMHints(server.dsp, win);
|
||||
XWMHints *wmhints = XGetWMHints(server.display, win);
|
||||
if (wmhints && wmhints->flags & XUrgencyHint) {
|
||||
add_urgent(task);
|
||||
}
|
||||
|
@ -953,7 +953,7 @@ void event_property_notify(XEvent *e)
|
|||
}
|
||||
|
||||
if (!server.got_root_win)
|
||||
server.root_win = RootWindow(server.dsp, server.screen);
|
||||
server.root_win = RootWindow(server.display, server.screen);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1154,24 +1154,24 @@ void dnd_enter(XClientMessageEvent *e)
|
|||
fprintf(stderr, "DnD %s:%d: DnDEnter\n", __FILE__, __LINE__);
|
||||
fprintf(stderr, "DnD %s:%d: DnDEnter. Supports > 3 types = %s\n", __FILE__, __LINE__, more_than_3 ? "yes" : "no");
|
||||
fprintf(stderr, "DnD %s:%d: Protocol version = %d\n", __FILE__, __LINE__, dnd_version);
|
||||
fprintf(stderr, "DnD %s:%d: Type 1 = %s\n", __FILE__, __LINE__, GetAtomName(server.dsp, e->data.l[2]));
|
||||
fprintf(stderr, "DnD %s:%d: Type 2 = %s\n", __FILE__, __LINE__, GetAtomName(server.dsp, e->data.l[3]));
|
||||
fprintf(stderr, "DnD %s:%d: Type 3 = %s\n", __FILE__, __LINE__, GetAtomName(server.dsp, e->data.l[4]));
|
||||
fprintf(stderr, "DnD %s:%d: Type 1 = %s\n", __FILE__, __LINE__, GetAtomName(server.display, e->data.l[2]));
|
||||
fprintf(stderr, "DnD %s:%d: Type 2 = %s\n", __FILE__, __LINE__, GetAtomName(server.display, e->data.l[3]));
|
||||
fprintf(stderr, "DnD %s:%d: Type 3 = %s\n", __FILE__, __LINE__, GetAtomName(server.display, e->data.l[4]));
|
||||
|
||||
// Query which conversions are available and pick the best
|
||||
|
||||
if (more_than_3) {
|
||||
// Fetch the list of possible conversions
|
||||
// Notice the similarity to TARGETS with paste.
|
||||
Property p = read_property(server.dsp, dnd_source_window, server.atom.XdndTypeList);
|
||||
dnd_atom = pick_target_from_targets(server.dsp, p);
|
||||
Property p = read_property(server.display, dnd_source_window, server.atom.XdndTypeList);
|
||||
dnd_atom = pick_target_from_targets(server.display, p);
|
||||
XFree(p.data);
|
||||
} else {
|
||||
// Use the available list
|
||||
dnd_atom = pick_target_from_atoms(server.dsp, e->data.l[2], e->data.l[3], e->data.l[4]);
|
||||
dnd_atom = pick_target_from_atoms(server.display, e->data.l[2], e->data.l[3], e->data.l[4]);
|
||||
}
|
||||
|
||||
fprintf(stderr, "DnD %s:%d: Requested type = %s\n", __FILE__, __LINE__, GetAtomName(server.dsp, dnd_atom));
|
||||
fprintf(stderr, "DnD %s:%d: Requested type = %s\n", __FILE__, __LINE__, GetAtomName(server.display, dnd_atom));
|
||||
}
|
||||
|
||||
void dnd_position(XClientMessageEvent *e)
|
||||
|
@ -1183,7 +1183,7 @@ void dnd_position(XClientMessageEvent *e)
|
|||
Window child;
|
||||
x = (e->data.l[2] >> 16) & 0xFFFF;
|
||||
y = e->data.l[2] & 0xFFFF;
|
||||
XTranslateCoordinates(server.dsp, server.root_win, e->window, x, y, &mapX, &mapY, &child);
|
||||
XTranslateCoordinates(server.display, server.root_win, e->window, x, y, &mapX, &mapY, &child);
|
||||
Task *task = click_task(panel, mapX, mapY);
|
||||
if (task) {
|
||||
if (task->desktop != server.desktop)
|
||||
|
@ -1215,21 +1215,21 @@ void dnd_position(XClientMessageEvent *e)
|
|||
se.data.l[4] = None; // None = drop will not be accepted
|
||||
}
|
||||
|
||||
XSendEvent(server.dsp, e->data.l[0], False, NoEventMask, (XEvent *)&se);
|
||||
XSendEvent(server.display, e->data.l[0], False, NoEventMask, (XEvent *)&se);
|
||||
}
|
||||
|
||||
void dnd_drop(XClientMessageEvent *e)
|
||||
{
|
||||
if (dnd_target_window && dnd_launcher_exec) {
|
||||
if (dnd_version >= 1) {
|
||||
XConvertSelection(server.dsp,
|
||||
XConvertSelection(server.display,
|
||||
server.atom.XdndSelection,
|
||||
XA_STRING,
|
||||
dnd_selection,
|
||||
dnd_target_window,
|
||||
e->data.l[2]);
|
||||
} else {
|
||||
XConvertSelection(server.dsp,
|
||||
XConvertSelection(server.display,
|
||||
server.atom.XdndSelection,
|
||||
XA_STRING,
|
||||
dnd_selection,
|
||||
|
@ -1249,7 +1249,7 @@ void dnd_drop(XClientMessageEvent *e)
|
|||
m.data.l[0] = dnd_target_window;
|
||||
m.data.l[1] = 0;
|
||||
m.data.l[2] = None; // Failed.
|
||||
XSendEvent(server.dsp, e->data.l[0], False, NoEventMask, (XEvent *)&m);
|
||||
XSendEvent(server.display, e->data.l[0], False, NoEventMask, (XEvent *)&m);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1278,15 +1278,15 @@ start:
|
|||
}
|
||||
|
||||
int damage_event, damage_error;
|
||||
XDamageQueryExtension(server.dsp, &damage_event, &damage_error);
|
||||
int x11_fd = ConnectionNumber(server.dsp);
|
||||
XSync(server.dsp, False);
|
||||
XDamageQueryExtension(server.display, &damage_event, &damage_error);
|
||||
int x11_fd = ConnectionNumber(server.display);
|
||||
XSync(server.display, False);
|
||||
|
||||
// XDND initialization
|
||||
dnd_source_window = 0;
|
||||
dnd_target_window = 0;
|
||||
dnd_version = 0;
|
||||
dnd_selection = XInternAtom(server.dsp, "PRIMARY", 0);
|
||||
dnd_selection = XInternAtom(server.display, "PRIMARY", 0);
|
||||
dnd_atom = None;
|
||||
dnd_sent_request = 0;
|
||||
dnd_launcher_exec = 0;
|
||||
|
@ -1304,7 +1304,7 @@ start:
|
|||
Panel *panel = &panels[i];
|
||||
|
||||
if (panel->is_hidden) {
|
||||
XCopyArea(server.dsp,
|
||||
XCopyArea(server.display,
|
||||
panel->hidden_pixmap,
|
||||
panel->main_win,
|
||||
server.gc,
|
||||
|
@ -1314,21 +1314,21 @@ start:
|
|||
panel->hidden_height,
|
||||
0,
|
||||
0);
|
||||
XSetWindowBackgroundPixmap(server.dsp, panel->main_win, panel->hidden_pixmap);
|
||||
XSetWindowBackgroundPixmap(server.display, panel->main_win, panel->hidden_pixmap);
|
||||
} else {
|
||||
if (panel->temp_pmap)
|
||||
XFreePixmap(server.dsp, panel->temp_pmap);
|
||||
XFreePixmap(server.display, panel->temp_pmap);
|
||||
panel->temp_pmap =
|
||||
XCreatePixmap(server.dsp, server.root_win, panel->area.width, panel->area.height, server.depth);
|
||||
XCreatePixmap(server.display, server.root_win, panel->area.width, panel->area.height, server.depth);
|
||||
render_panel(panel);
|
||||
if (panel == (Panel *)systray.area.panel) {
|
||||
if (refresh_systray && panel && !panel->is_hidden) {
|
||||
refresh_systray = FALSE;
|
||||
XSetWindowBackgroundPixmap(server.dsp, panel->main_win, panel->temp_pmap);
|
||||
XSetWindowBackgroundPixmap(server.display, panel->main_win, panel->temp_pmap);
|
||||
refresh_systray_icons();
|
||||
}
|
||||
}
|
||||
XCopyArea(server.dsp,
|
||||
XCopyArea(server.display,
|
||||
panel->temp_pmap,
|
||||
panel->main_win,
|
||||
server.gc,
|
||||
|
@ -1340,7 +1340,7 @@ start:
|
|||
0);
|
||||
}
|
||||
}
|
||||
XFlush(server.dsp);
|
||||
XFlush(server.display);
|
||||
}
|
||||
|
||||
// Create a File Description Set containing x11_fd
|
||||
|
@ -1368,7 +1368,7 @@ start:
|
|||
struct timeval *select_timeout = (next_timeout.tv_sec >= 0 && next_timeout.tv_usec >= 0) ? &next_timeout : NULL;
|
||||
|
||||
// Wait for X Event or a Timer
|
||||
if (XPending(server.dsp) > 0 || select(maxfd + 1, &fdset, 0, 0, select_timeout) >= 0) {
|
||||
if (XPending(server.display) > 0 || select(maxfd + 1, &fdset, 0, 0, select_timeout) >= 0) {
|
||||
uevent_handler();
|
||||
|
||||
if (sn_pipe_valid) {
|
||||
|
@ -1388,12 +1388,12 @@ start:
|
|||
}
|
||||
}
|
||||
}
|
||||
if (XPending(server.dsp) > 0) {
|
||||
if (XPending(server.display) > 0) {
|
||||
XEvent e;
|
||||
XNextEvent(server.dsp, &e);
|
||||
XNextEvent(server.display, &e);
|
||||
#if HAVE_SN
|
||||
if (startup_notifications)
|
||||
sn_display_process_event(server.sn_dsp, &e);
|
||||
sn_display_process_event(server.sn_display, &e);
|
||||
#endif // HAVE_SN
|
||||
|
||||
Panel *panel = get_panel(e.xany.window);
|
||||
|
@ -1560,32 +1560,32 @@ start:
|
|||
"DnD %s:%d: Selection atom = %s\n",
|
||||
__FILE__,
|
||||
__LINE__,
|
||||
GetAtomName(server.dsp, e.xselection.selection));
|
||||
GetAtomName(server.display, e.xselection.selection));
|
||||
fprintf(stderr,
|
||||
"DnD %s:%d: Target atom = %s\n",
|
||||
__FILE__,
|
||||
__LINE__,
|
||||
GetAtomName(server.dsp, target));
|
||||
GetAtomName(server.display, target));
|
||||
fprintf(stderr,
|
||||
"DnD %s:%d: Property atom = %s\n",
|
||||
__FILE__,
|
||||
__LINE__,
|
||||
GetAtomName(server.dsp, e.xselection.property));
|
||||
GetAtomName(server.display, e.xselection.property));
|
||||
|
||||
if (e.xselection.property != None && dnd_launcher_exec) {
|
||||
Property prop = read_property(server.dsp, dnd_target_window, dnd_selection);
|
||||
Property prop = read_property(server.display, dnd_target_window, dnd_selection);
|
||||
|
||||
// If we're being given a list of targets (possible conversions)
|
||||
if (target == server.atom.TARGETS && !dnd_sent_request) {
|
||||
dnd_sent_request = 1;
|
||||
dnd_atom = pick_target_from_targets(server.dsp, prop);
|
||||
dnd_atom = pick_target_from_targets(server.display, prop);
|
||||
|
||||
if (dnd_atom == None) {
|
||||
fprintf(stderr, "No matching datatypes.\n");
|
||||
} else {
|
||||
// Request the data type we are able to select
|
||||
fprintf(stderr, "Now requsting type %s", GetAtomName(server.dsp, dnd_atom));
|
||||
XConvertSelection(server.dsp,
|
||||
fprintf(stderr, "Now requsting type %s", GetAtomName(server.display, dnd_atom));
|
||||
XConvertSelection(server.display,
|
||||
dnd_selection,
|
||||
dnd_atom,
|
||||
dnd_selection,
|
||||
|
@ -1656,15 +1656,15 @@ start:
|
|||
XClientMessageEvent m;
|
||||
memset(&m, 0, sizeof(m));
|
||||
m.type = ClientMessage;
|
||||
m.display = server.dsp;
|
||||
m.display = server.display;
|
||||
m.window = dnd_source_window;
|
||||
m.message_type = server.atom.XdndFinished;
|
||||
m.format = 32;
|
||||
m.data.l[0] = dnd_target_window;
|
||||
m.data.l[1] = 1;
|
||||
m.data.l[2] = server.atom.XdndActionCopy; // We only ever copy.
|
||||
XSendEvent(server.dsp, dnd_source_window, False, NoEventMask, (XEvent *)&m);
|
||||
XSync(server.dsp, False);
|
||||
XSendEvent(server.display, dnd_source_window, False, NoEventMask, (XEvent *)&m);
|
||||
XSync(server.display, False);
|
||||
}
|
||||
|
||||
XFree(prop.data);
|
||||
|
|
|
@ -57,7 +57,7 @@ void cleanup_tooltip()
|
|||
tooltip_hide(NULL);
|
||||
tooltip_copy_text(NULL);
|
||||
if (g_tooltip.window)
|
||||
XDestroyWindow(server.dsp, g_tooltip.window);
|
||||
XDestroyWindow(server.display, g_tooltip.window);
|
||||
g_tooltip.window = 0;
|
||||
pango_font_description_free(g_tooltip.font_desc);
|
||||
g_tooltip.font_desc = NULL;
|
||||
|
@ -77,8 +77,8 @@ void init_tooltip()
|
|||
attr.border_pixel = 0;
|
||||
unsigned long mask = CWEventMask | CWColormap | CWBorderPixel | CWBackPixel | CWOverrideRedirect;
|
||||
if (g_tooltip.window)
|
||||
XDestroyWindow(server.dsp, g_tooltip.window);
|
||||
g_tooltip.window = XCreateWindow(server.dsp,
|
||||
XDestroyWindow(server.display, g_tooltip.window);
|
||||
g_tooltip.window = XCreateWindow(server.display,
|
||||
server.root_win,
|
||||
0,
|
||||
0,
|
||||
|
@ -131,15 +131,15 @@ void tooltip_show(void *arg)
|
|||
{
|
||||
int mx, my;
|
||||
Window w;
|
||||
XTranslateCoordinates(server.dsp, server.root_win, g_tooltip.panel->main_win, x, y, &mx, &my, &w);
|
||||
XTranslateCoordinates(server.display, server.root_win, g_tooltip.panel->main_win, x, y, &mx, &my, &w);
|
||||
Area *area;
|
||||
area = click_area(g_tooltip.panel, mx, my);
|
||||
if (!g_tooltip.mapped && area->_get_tooltip_text) {
|
||||
tooltip_copy_text(area);
|
||||
g_tooltip.mapped = True;
|
||||
XMapWindow(server.dsp, g_tooltip.window);
|
||||
XMapWindow(server.display, g_tooltip.window);
|
||||
tooltip_update();
|
||||
XFlush(server.dsp);
|
||||
XFlush(server.display);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -148,7 +148,7 @@ void tooltip_update_geometry()
|
|||
cairo_surface_t *cs;
|
||||
cairo_t *c;
|
||||
PangoLayout *layout;
|
||||
cs = cairo_xlib_surface_create(server.dsp, g_tooltip.window, server.visual, width, height);
|
||||
cs = cairo_xlib_surface_create(server.display, g_tooltip.window, server.visual, width, height);
|
||||
c = cairo_create(cs);
|
||||
layout = pango_cairo_create_layout(c);
|
||||
pango_layout_set_font_description(layout, g_tooltip.font_desc);
|
||||
|
@ -233,13 +233,13 @@ void tooltip_update()
|
|||
just_shown = 0;
|
||||
}
|
||||
tooltip_adjust_geometry();
|
||||
XMoveResizeWindow(server.dsp, g_tooltip.window, x, y, width, height);
|
||||
XMoveResizeWindow(server.display, g_tooltip.window, x, y, width, height);
|
||||
|
||||
// Stuff for drawing the tooltip
|
||||
cairo_surface_t *cs;
|
||||
cairo_t *c;
|
||||
PangoLayout *layout;
|
||||
cs = cairo_xlib_surface_create(server.dsp, g_tooltip.window, server.visual, width, height);
|
||||
cs = cairo_xlib_surface_create(server.display, g_tooltip.window, server.visual, width, height);
|
||||
c = cairo_create(cs);
|
||||
Color bc = g_tooltip.bg->fill_color;
|
||||
Border b = g_tooltip.bg->border;
|
||||
|
@ -297,8 +297,8 @@ void tooltip_hide(void *arg)
|
|||
{
|
||||
if (g_tooltip.mapped) {
|
||||
g_tooltip.mapped = False;
|
||||
XUnmapWindow(server.dsp, g_tooltip.window);
|
||||
XFlush(server.dsp);
|
||||
XUnmapWindow(server.display, g_tooltip.window);
|
||||
XFlush(server.display);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -228,7 +228,7 @@ void draw_tree(Area *a)
|
|||
}
|
||||
|
||||
if (a->pix)
|
||||
XCopyArea(server.dsp, a->pix, ((Panel *)a->panel)->temp_pmap, server.gc, 0, 0, a->width, a->height, a->posx, a->posy);
|
||||
XCopyArea(server.display, a->pix, ((Panel *)a->panel)->temp_pmap, server.gc, 0, 0, a->width, a->height, a->posx, a->posy);
|
||||
|
||||
for (GList *l = a->children; l; l = l->next)
|
||||
draw_tree((Area *)l->data);
|
||||
|
@ -329,13 +329,13 @@ void schedule_redraw(Area *a)
|
|||
|
||||
if (a->has_mouse_over_effect) {
|
||||
for (int i = 0; i < MOUSE_STATE_COUNT; i++) {
|
||||
XFreePixmap(server.dsp, a->pix_by_state[i]);
|
||||
XFreePixmap(server.display, a->pix_by_state[i]);
|
||||
if (a->pix == a->pix_by_state[i])
|
||||
a->pix = None;
|
||||
a->pix_by_state[i] = None;
|
||||
}
|
||||
if (a->pix) {
|
||||
XFreePixmap(server.dsp, a->pix);
|
||||
XFreePixmap(server.display, a->pix);
|
||||
a->pix = None;
|
||||
}
|
||||
}
|
||||
|
@ -371,19 +371,19 @@ void show(Area *a)
|
|||
void draw(Area *a)
|
||||
{
|
||||
if (a->pix) {
|
||||
XFreePixmap(server.dsp, a->pix);
|
||||
XFreePixmap(server.display, a->pix);
|
||||
if (a->pix_by_state[a->has_mouse_over_effect ? a->mouse_state : 0] != a->pix)
|
||||
XFreePixmap(server.dsp, a->pix_by_state[a->has_mouse_over_effect ? a->mouse_state : 0]);
|
||||
XFreePixmap(server.display, a->pix_by_state[a->has_mouse_over_effect ? a->mouse_state : 0]);
|
||||
}
|
||||
a->pix = XCreatePixmap(server.dsp, server.root_win, a->width, a->height, server.depth);
|
||||
a->pix = XCreatePixmap(server.display, server.root_win, a->width, a->height, server.depth);
|
||||
a->pix_by_state[a->has_mouse_over_effect ? a->mouse_state : 0] = a->pix;
|
||||
|
||||
// Add layer of root pixmap (or clear pixmap if real_transparency==true)
|
||||
if (server.real_transparency)
|
||||
clear_pixmap(a->pix, 0, 0, a->width, a->height);
|
||||
XCopyArea(server.dsp, ((Panel *)a->panel)->temp_pmap, a->pix, server.gc, a->posx, a->posy, a->width, a->height, 0, 0);
|
||||
XCopyArea(server.display, ((Panel *)a->panel)->temp_pmap, a->pix, server.gc, a->posx, a->posy, a->width, a->height, 0, 0);
|
||||
|
||||
cairo_surface_t *cs = cairo_xlib_surface_create(server.dsp, a->pix, server.visual, a->width, a->height);
|
||||
cairo_surface_t *cs = cairo_xlib_surface_create(server.display, a->pix, server.visual, a->width, a->height);
|
||||
cairo_t *c = cairo_create(cs);
|
||||
|
||||
draw_background(a, c);
|
||||
|
@ -502,14 +502,14 @@ void free_area(Area *a)
|
|||
a->children = NULL;
|
||||
}
|
||||
for (int i = 0; i < MOUSE_STATE_COUNT; i++) {
|
||||
XFreePixmap(server.dsp, a->pix_by_state[i]);
|
||||
XFreePixmap(server.display, a->pix_by_state[i]);
|
||||
if (a->pix == a->pix_by_state[i]) {
|
||||
a->pix = None;
|
||||
}
|
||||
a->pix_by_state[i] = None;
|
||||
}
|
||||
if (a->pix) {
|
||||
XFreePixmap(server.dsp, a->pix);
|
||||
XFreePixmap(server.display, a->pix);
|
||||
a->pix = None;
|
||||
}
|
||||
if (mouse_over_area == a) {
|
||||
|
|
|
@ -419,26 +419,26 @@ void render_image(Drawable d, int x, int y)
|
|||
|
||||
int w = imlib_image_get_width(), h = imlib_image_get_height();
|
||||
|
||||
Pixmap pixmap = XCreatePixmap(server.dsp, server.root_win, w, h, 32);
|
||||
Pixmap pixmap = XCreatePixmap(server.display, server.root_win, w, h, 32);
|
||||
imlib_context_set_drawable(pixmap);
|
||||
imlib_context_set_blend(0);
|
||||
imlib_render_image_on_drawable(0, 0);
|
||||
|
||||
Pixmap mask = XCreatePixmap(server.dsp, server.root_win, w, h, 32);
|
||||
Pixmap mask = XCreatePixmap(server.display, server.root_win, w, h, 32);
|
||||
imlib_context_set_drawable(mask);
|
||||
imlib_context_set_blend(0);
|
||||
imlib_render_image_on_drawable(0, 0);
|
||||
|
||||
Picture pict = XRenderCreatePicture(server.dsp, pixmap, XRenderFindStandardFormat(server.dsp, PictStandardARGB32), 0, 0);
|
||||
Picture pict_drawable = XRenderCreatePicture(server.dsp, d, XRenderFindVisualFormat(server.dsp, server.visual), 0, 0);
|
||||
Picture pict_mask = XRenderCreatePicture(server.dsp, mask, XRenderFindStandardFormat(server.dsp, PictStandardARGB32), 0, 0);
|
||||
XRenderComposite(server.dsp, PictOpOver, pict, pict_mask, pict_drawable, 0, 0, 0, 0, x, y, w, h);
|
||||
Picture pict = XRenderCreatePicture(server.display, pixmap, XRenderFindStandardFormat(server.display, PictStandardARGB32), 0, 0);
|
||||
Picture pict_drawable = XRenderCreatePicture(server.display, d, XRenderFindVisualFormat(server.display, server.visual), 0, 0);
|
||||
Picture pict_mask = XRenderCreatePicture(server.display, mask, XRenderFindStandardFormat(server.display, PictStandardARGB32), 0, 0);
|
||||
XRenderComposite(server.display, PictOpOver, pict, pict_mask, pict_drawable, 0, 0, 0, 0, x, y, w, h);
|
||||
|
||||
XRenderFreePicture(server.dsp, pict_mask);
|
||||
XRenderFreePicture(server.dsp, pict_drawable);
|
||||
XRenderFreePicture(server.dsp, pict);
|
||||
XFreePixmap(server.dsp, mask);
|
||||
XFreePixmap(server.dsp, pixmap);
|
||||
XRenderFreePicture(server.display, pict_mask);
|
||||
XRenderFreePicture(server.display, pict_drawable);
|
||||
XRenderFreePicture(server.display, pict);
|
||||
XFreePixmap(server.display, mask);
|
||||
XFreePixmap(server.display, pixmap);
|
||||
}
|
||||
|
||||
void draw_text(PangoLayout *layout, cairo_t *c, int posx, int posy, Color *color, int font_shadow)
|
||||
|
@ -557,11 +557,11 @@ void draw_rect(cairo_t *c, double x, double y, double w, double h, double r)
|
|||
|
||||
void clear_pixmap(Pixmap p, int x, int y, int w, int h)
|
||||
{
|
||||
Picture pict = XRenderCreatePicture(server.dsp, p, XRenderFindVisualFormat(server.dsp, server.visual), 0, 0);
|
||||
Picture pict = XRenderCreatePicture(server.display, p, XRenderFindVisualFormat(server.display, server.visual), 0, 0);
|
||||
XRenderColor col;
|
||||
col.red = col.green = col.blue = col.alpha = 0;
|
||||
XRenderFillRectangle(server.dsp, PictOpSrc, pict, &col, x, y, w, h);
|
||||
XRenderFreePicture(server.dsp, pict);
|
||||
XRenderFillRectangle(server.display, PictOpSrc, pict, &col, x, y, w, h);
|
||||
XRenderFreePicture(server.display, pict);
|
||||
}
|
||||
|
||||
void get_text_size2(PangoFontDescription *font,
|
||||
|
@ -578,9 +578,9 @@ void get_text_size2(PangoFontDescription *font,
|
|||
{
|
||||
PangoRectangle rect_ink, rect;
|
||||
|
||||
Pixmap pmap = XCreatePixmap(server.dsp, server.root_win, panel_height, panel_width, server.depth);
|
||||
Pixmap pmap = XCreatePixmap(server.display, server.root_win, panel_height, panel_width, server.depth);
|
||||
|
||||
cairo_surface_t *cs = cairo_xlib_surface_create(server.dsp, pmap, server.visual, panel_height, panel_width);
|
||||
cairo_surface_t *cs = cairo_xlib_surface_create(server.display, pmap, server.visual, panel_height, panel_width);
|
||||
cairo_t *c = cairo_create(cs);
|
||||
|
||||
PangoLayout *layout = pango_cairo_create_layout(c);
|
||||
|
@ -603,7 +603,7 @@ void get_text_size2(PangoFontDescription *font,
|
|||
g_object_unref(layout);
|
||||
cairo_destroy(c);
|
||||
cairo_surface_destroy(cs);
|
||||
XFreePixmap(server.dsp, pmap);
|
||||
XFreePixmap(server.display, pmap);
|
||||
}
|
||||
|
||||
#if !GLIB_CHECK_VERSION (2, 33, 4)
|
||||
|
|
|
@ -74,7 +74,7 @@ gboolean window_is_hidden(Window win)
|
|||
}
|
||||
// do not add transient_for windows if the transient window is already in the taskbar
|
||||
window = win;
|
||||
while (XGetTransientForHint(server.dsp, window, &window)) {
|
||||
while (XGetTransientForHint(server.display, window, &window)) {
|
||||
if (task_get_tasks(window)) {
|
||||
XFree(at);
|
||||
return TRUE;
|
||||
|
@ -162,7 +162,7 @@ int get_window_monitor(Window win)
|
|||
int i, x, y;
|
||||
Window src;
|
||||
|
||||
XTranslateCoordinates(server.dsp, win, server.root_win, 0, 0, &x, &y, &src);
|
||||
XTranslateCoordinates(server.display, win, server.root_win, 0, 0, &x, &y, &src);
|
||||
int best_match = -1;
|
||||
int match_right = 0;
|
||||
int match_bottom = 0;
|
||||
|
@ -190,8 +190,8 @@ void get_window_coordinates(Window win, int *x, int *y, int *w, int *h)
|
|||
int dummy_int;
|
||||
unsigned ww, wh, bw, bh;
|
||||
Window src;
|
||||
XTranslateCoordinates(server.dsp, win, server.root_win, 0, 0, x, y, &src);
|
||||
XGetGeometry(server.dsp, win, &src, &dummy_int, &dummy_int, &ww, &wh, &bw, &bh);
|
||||
XTranslateCoordinates(server.display, win, server.root_win, 0, 0, x, y, &src);
|
||||
XGetGeometry(server.display, win, &src, &dummy_int, &dummy_int, &ww, &wh, &bw, &bh);
|
||||
*w = ww + bw;
|
||||
*h = wh + bh;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue