window: rename to xwindow

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-09-17 17:51:06 +02:00
parent 371ee3e8cc
commit 3ce7638e0f
12 changed files with 61 additions and 63 deletions

View File

@ -59,7 +59,7 @@ set(AWE_SRCS
${SOURCE_DIR}/systray.c
${SOURCE_DIR}/objects/tag.c
${SOURCE_DIR}/objects/widget.c
${SOURCE_DIR}/window.c
${SOURCE_DIR}/xwindow.c
${SOURCE_DIR}/image.c
${SOURCE_DIR}/draw.c
${SOURCE_DIR}/font.c

View File

@ -32,7 +32,7 @@
#include "awesome.h"
#include "spawn.h"
#include "objects/client.h"
#include "window.h"
#include "xwindow.h"
#include "ewmh.h"
#include "dbus.h"
#include "systray.h"
@ -145,7 +145,7 @@ scan(void)
attr_wins[i] = xcb_get_window_attributes_unchecked(globalconf.connection,
wins[i]);
state_wins[i] = window_state_get_unchecked(wins[i]);
state_wins[i] = xwindow_get_state_unchecked(wins[i]);
}
xcb_get_geometry_cookie_t *geom_wins[tree_c_len];
@ -156,7 +156,7 @@ scan(void)
attr_wins[i],
NULL);
state = window_state_get_reply(state_wins[i]);
state = xwindow_get_state_reply(state_wins[i]);
if(!attr_r || attr_r->override_redirect
|| attr_r->map_state == XCB_MAP_STATE_UNVIEWABLE

View File

@ -21,7 +21,6 @@
#include "banning.h"
#include "objects/tag.h"
#include "window.h"
#include "screen.h"
/** Reban windows following current selected tags.

10
event.c
View File

@ -28,7 +28,7 @@
#include "awesome.h"
#include "event.h"
#include "objects/tag.h"
#include "window.h"
#include "xwindow.h"
#include "ewmh.h"
#include "objects/client.h"
#include "objects/widget.h"
@ -283,7 +283,7 @@ event_handle_configurerequest(void *data __attribute__ ((unused)),
{
geometry.width -= 2 * c->border_width;
geometry.height -= 2 * c->border_width;
window_configure(c->window, geometry, c->border_width);
xwindow_configure(c->window, geometry, c->border_width);
}
}
else
@ -656,7 +656,7 @@ event_handle_unmapnotify(void *data __attribute__ ((unused)),
{
if(ev->event == xutil_screen_get(connection, c->phys_screen)->root
&& XCB_EVENT_SENT(ev)
&& window_state_get_reply(window_state_get_unchecked(c->window)) == XCB_WM_STATE_NORMAL)
&& xwindow_get_state_reply(xwindow_get_state_unchecked(c->window)) == XCB_WM_STATE_NORMAL)
client_unmanage(c);
}
else
@ -769,14 +769,14 @@ event_handle_mappingnotify(void *data,
xcb_screen_t *s = xutil_screen_get(globalconf.connection, phys_screen);
/* yes XCB_BUTTON_MASK_ANY is also for grab_key even if it's look weird */
xcb_ungrab_key(connection, XCB_GRAB_ANY, s->root, XCB_BUTTON_MASK_ANY);
window_grabkeys(s->root, &globalconf.keys);
xwindow_grabkeys(s->root, &globalconf.keys);
}
foreach(_c, globalconf.clients)
{
client_t *c = *_c;
xcb_ungrab_key(connection, XCB_GRAB_ANY, c->window, XCB_BUTTON_MASK_ANY);
window_grabkeys(c->window, &c->keys);
xwindow_grabkeys(c->window, &c->keys);
}
}

1
luaa.c
View File

@ -41,7 +41,6 @@
#include "screen.h"
#include "event.h"
#include "selection.h"
#include "window.h"
#include "common/xcursor.h"
#include "common/buffer.h"

View File

@ -30,7 +30,7 @@
#include "property.h"
#include "spawn.h"
#include "luaa.h"
#include "window.h"
#include "xwindow.h"
#include "common/atoms.h"
#include "common/xutil.h"
@ -77,7 +77,7 @@ client_set_opacity(lua_State *L, int cidx, double opacity)
if(c->opacity != opacity)
{
c->opacity = opacity;
window_opacity_set(c->window, opacity);
xwindow_set_opacity(c->window, opacity);
luaA_object_emit_signal(L, cidx, "property::opacity", 0);
}
}
@ -321,7 +321,7 @@ client_set_focus(client_t *c, bool set_input_focus)
xcb_set_input_focus(globalconf.connection, XCB_INPUT_FOCUS_PARENT,
c->window, XCB_CURRENT_TIME);
if(takefocus)
window_takefocus(c->window);
xwindow_takefocus(c->window);
}
/** Prepare banning a client by running all needed lua events.
@ -646,8 +646,7 @@ HANDLE_GEOM(height)
property_update_net_wm_pid(c, NULL);
property_update_net_wm_icon(c, NULL);
/* get opacity */
client_set_opacity(globalconf.L, -1, window_opacity_get(c->window));
client_set_opacity(globalconf.L, -1, xwindow_get_opacity(c->window));
/* Then check clients hints */
ewmh_client_check_hints(c);
@ -684,7 +683,7 @@ HANDLE_GEOM(height)
*
* At this stage it's just safer to keep it in normal state and avoid confusion.
*/
window_state_set(c->window, XCB_WM_STATE_NORMAL);
xwindow_set_state(c->window, XCB_WM_STATE_NORMAL);
if(!startup)
{
@ -903,9 +902,9 @@ client_set_minimized(lua_State *L, int cidx, bool s)
c->minimized = s;
banning_need_update((c)->screen);
if(s)
window_state_set(c->window, XCB_WM_STATE_ICONIC);
xwindow_set_state(c->window, XCB_WM_STATE_ICONIC);
else
window_state_set(c->window, XCB_WM_STATE_NORMAL);
xwindow_set_state(c->window, XCB_WM_STATE_NORMAL);
ewmh_client_update_hints(c);
if(strut_has_value(&c->strut))
screen_emit_signal(globalconf.L, c->screen, "property::workarea", 0);
@ -1223,7 +1222,7 @@ client_unmanage(client_t *c)
if(strut_has_value(&c->strut))
screen_emit_signal(globalconf.L, c->screen, "property::workarea", 0);
window_state_set(c->window, XCB_WM_STATE_WITHDRAWN);
xwindow_set_state(c->window, XCB_WM_STATE_WITHDRAWN);
ewmh_update_net_client_list(c->phys_screen);
@ -2014,7 +2013,7 @@ luaA_client_buttons(lua_State *L)
{
luaA_button_array_set(L, 1, 2, buttons);
luaA_object_emit_signal(L, 1, "property::buttons", 0);
window_buttons_grab(client->window, &client->buttons);
xwindow_buttons_grab(client->window, &client->buttons);
}
return luaA_button_array_get(L, 1, buttons);
@ -2039,7 +2038,7 @@ luaA_client_keys(lua_State *L)
luaA_key_array_set(L, 1, 2, keys);
luaA_object_emit_signal(L, 1, "property::keys", 0);
xcb_ungrab_key(globalconf.connection, XCB_GRAB_ANY, c->window, XCB_BUTTON_MASK_ANY);
window_grabkeys(c->window, keys);
xwindow_grabkeys(c->window, keys);
}
return luaA_key_array_get(L, 1, keys);

View File

@ -25,7 +25,7 @@
#include "wibox.h"
#include "objects/client.h"
#include "screen.h"
#include "window.h"
#include "xwindow.h"
#include "luaa.h"
#include "ewmh.h"
#include "common/xcursor.h"
@ -348,7 +348,7 @@ wibox_set_opacity(lua_State *L, int udx, double opacity)
{
w->opacity = opacity;
if(w->window)
window_opacity_set(w->window, opacity);
xwindow_set_opacity(w->window, opacity);
luaA_object_emit_signal(L, udx, "property::opacity", 0);
}
}
@ -740,11 +740,11 @@ wibox_attach(lua_State *L, int udx, screen_t *s)
wibox_init(wibox, phys_screen);
window_set_cursor(wibox->window,
xwindow_set_cursor(wibox->window,
xcursor_new(globalconf.connection, xcursor_font_fromstr(wibox->cursor)));
if(wibox->opacity != -1)
window_opacity_set(wibox->window, wibox->opacity);
xwindow_set_opacity(wibox->window, wibox->opacity);
ewmh_update_strut(wibox->window, &wibox->strut);
@ -1117,7 +1117,7 @@ luaA_wibox_set_cursor(lua_State *L, wibox_t *wibox)
xcb_cursor_t cursor = xcursor_new(globalconf.connection, cursor_font);
p_delete(&wibox->cursor);
wibox->cursor = a_strdup(buf);
window_set_cursor(wibox->window, cursor);
xwindow_set_cursor(wibox->window, cursor);
luaA_object_emit_signal(L, -3, "property::cursor", 0);
}
}

View File

@ -26,7 +26,7 @@
#include "objects/client.h"
#include "ewmh.h"
#include "objects/wibox.h"
#include "window.h"
#include "xwindow.h"
#include "luaa.h"
#include "common/atoms.h"
#include "common/xutil.h"
@ -390,7 +390,7 @@ property_handle_net_wm_opacity(void *data __attribute__ ((unused)),
if(wibox)
{
luaA_object_push(globalconf.L, wibox);
wibox_set_opacity(globalconf.L, -1, window_opacity_get_from_reply(reply));
wibox_set_opacity(globalconf.L, -1, xwindow_get_opacity_from_reply(reply));
lua_pop(globalconf.L, -1);
}
else
@ -399,7 +399,7 @@ property_handle_net_wm_opacity(void *data __attribute__ ((unused)),
if(c)
{
luaA_object_push(globalconf.L, c);
client_set_opacity(globalconf.L, -1, window_opacity_get_from_reply(reply));
client_set_opacity(globalconf.L, -1, xwindow_get_opacity_from_reply(reply));
lua_pop(globalconf.L, 1);
}
}

4
root.c
View File

@ -25,7 +25,7 @@
#include "objects/button.h"
#include "objects/wibox.h"
#include "luaa.h"
#include "window.h"
#include "xwindow.h"
#include "common/xcursor.h"
#include "common/tokenize.h"
#include "common/xutil.h"
@ -134,7 +134,7 @@ luaA_root_keys(lua_State *L)
{
xcb_screen_t *s = xutil_screen_get(globalconf.connection, phys_screen);
xcb_ungrab_key(globalconf.connection, XCB_GRAB_ANY, s->root, XCB_BUTTON_MASK_ANY);
window_grabkeys(s->root, &globalconf.keys);
xwindow_grabkeys(s->root, &globalconf.keys);
}
return 1;

View File

@ -25,7 +25,7 @@
#include "screen.h"
#include "systray.h"
#include "window.h"
#include "xwindow.h"
#include "objects/widget.h"
#include "common/atoms.h"
#include "common/xutil.h"
@ -153,7 +153,7 @@ systray_request_handle(xcb_window_t embed_win, int phys_screen, xembed_info_t *i
xcb_change_window_attributes(globalconf.connection, embed_win, XCB_CW_EVENT_MASK,
select_input_val);
window_state_set(embed_win, XCB_WM_STATE_WITHDRAWN);
xwindow_set_state(embed_win, XCB_WM_STATE_WITHDRAWN);
xcb_reparent_window(globalconf.connection, embed_win,
globalconf.screens.tab[phys_screen].systray.window,

View File

@ -1,5 +1,5 @@
/*
* window.c - window handling functions
* xwindow.c - X window handling functions
*
* Copyright © 2007-2009 Julien Danjou <julien@danjou.info>
*
@ -22,7 +22,7 @@
#include <xcb/xcb.h>
#include <xcb/xcb_atom.h>
#include "window.h"
#include "xwindow.h"
#include "objects/button.h"
#include "common/atoms.h"
@ -34,7 +34,7 @@
* \param state The state to set.
*/
void
window_state_set(xcb_window_t win, long state)
xwindow_set_state(xcb_window_t win, long state)
{
long data[] = { state, XCB_NONE };
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE, win,
@ -46,7 +46,7 @@ window_state_set(xcb_window_t win, long state)
* \return The cookie associated with the request.
*/
xcb_get_property_cookie_t
window_state_get_unchecked(xcb_window_t w)
xwindow_get_state_unchecked(xcb_window_t w)
{
return xcb_get_property_unchecked(globalconf.connection, false, w, WM_STATE,
WM_STATE, 0L, 2L);
@ -57,7 +57,7 @@ window_state_get_unchecked(xcb_window_t w)
* \return The current state of the window, or 0 on error.
*/
uint32_t
window_state_get_reply(xcb_get_property_cookie_t cookie)
xwindow_get_state_reply(xcb_get_property_cookie_t cookie)
{
uint32_t result = 0;
xcb_get_property_reply_t *prop_r;
@ -79,7 +79,7 @@ window_state_get_reply(xcb_get_property_cookie_t cookie)
* \param border The new border size.
*/
void
window_configure(xcb_window_t win, area_t geometry, int border)
xwindow_configure(xcb_window_t win, area_t geometry, int border)
{
xcb_configure_notify_event_t ce;
@ -101,7 +101,7 @@ window_configure(xcb_window_t win, area_t geometry, int border)
* \param buttons The buttons to grab.
*/
void
window_buttons_grab(xcb_window_t win, button_array_t *buttons)
xwindow_buttons_grab(xcb_window_t win, button_array_t *buttons)
{
foreach(b, *buttons)
xcb_grab_button(globalconf.connection, false, win, BUTTONMASK,
@ -114,7 +114,7 @@ window_buttons_grab(xcb_window_t win, button_array_t *buttons)
* \param k The key.
*/
static void
window_grabkey(xcb_window_t win, keyb_t *k)
xwindow_grabkey(xcb_window_t win, keyb_t *k)
{
if(k->keycode)
xcb_grab_key(globalconf.connection, true, win,
@ -133,10 +133,10 @@ window_grabkey(xcb_window_t win, keyb_t *k)
}
void
window_grabkeys(xcb_window_t win, key_array_t *keys)
xwindow_grabkeys(xcb_window_t win, key_array_t *keys)
{
foreach(k, *keys)
window_grabkey(win, *k);
xwindow_grabkey(win, *k);
}
/** Get the opacity of a window.
@ -144,7 +144,7 @@ window_grabkeys(xcb_window_t win, key_array_t *keys)
* \return The opacity, between 0 and 1 or -1 or no opacity set.
*/
double
window_opacity_get(xcb_window_t win)
xwindow_get_opacity(xcb_window_t win)
{
double ret;
@ -155,7 +155,7 @@ window_opacity_get(xcb_window_t win)
xcb_get_property_reply_t *prop_r =
xcb_get_property_reply(globalconf.connection, prop_c, NULL);
ret = window_opacity_get_from_reply(prop_r);
ret = xwindow_get_opacity_from_reply(prop_r);
p_delete(&prop_r);
return ret;
}
@ -164,7 +164,8 @@ window_opacity_get(xcb_window_t win)
* \param prop_r A reply to a get property request for _NET_WM_WINDOW_OPACITY.
* \return The opacity, between 0 and 1.
*/
double window_opacity_get_from_reply(xcb_get_property_reply_t *prop_r)
double
xwindow_get_opacity_from_reply(xcb_get_property_reply_t *prop_r)
{
if(prop_r && prop_r->value_len && prop_r->format == 32)
{
@ -180,7 +181,7 @@ double window_opacity_get_from_reply(xcb_get_property_reply_t *prop_r)
* \param opacity Opacity of the window, between 0 and 1.
*/
void
window_opacity_set(xcb_window_t win, double opacity)
xwindow_set_opacity(xcb_window_t win, double opacity)
{
if(opacity >= 0 && opacity <= 1)
{
@ -196,7 +197,7 @@ window_opacity_set(xcb_window_t win, double opacity)
* \param win destination window
*/
void
window_takefocus(xcb_window_t win)
xwindow_takefocus(xcb_window_t win)
{
xcb_client_message_event_t ev;
@ -219,7 +220,7 @@ window_takefocus(xcb_window_t win)
* \param c The cursor.
*/
void
window_set_cursor(xcb_window_t w, xcb_cursor_t c)
xwindow_set_cursor(xcb_window_t w, xcb_cursor_t c)
{
xcb_change_window_attributes(globalconf.connection, w, XCB_CW_CURSOR,
(const uint32_t[]) { c });

View File

@ -1,5 +1,5 @@
/*
* window.h - window handling functions header
*x window.h -x window handling functions header
*
* Copyright © 2007-2009 Julien Danjou <julien@danjou.info>
*
@ -25,18 +25,18 @@
#include "globalconf.h"
#include "draw.h"
void window_state_set(xcb_window_t, long);
xcb_get_property_cookie_t window_state_get_unchecked(xcb_window_t);
uint32_t window_state_get_reply(xcb_get_property_cookie_t);
void window_configure(xcb_window_t, area_t, int);
void window_buttons_grab(xcb_window_t, button_array_t *);
double window_opacity_get(xcb_window_t);
double window_opacity_get_from_reply(xcb_get_property_reply_t *);
void window_opacity_set(xcb_window_t, double);
void window_grabbuttons(xcb_window_t, xcb_window_t, button_array_t *);
void window_grabkeys(xcb_window_t, key_array_t *);
void window_takefocus(xcb_window_t);
void window_set_cursor(xcb_window_t, xcb_cursor_t);
void xwindow_set_state(xcb_window_t, long);
xcb_get_property_cookie_t xwindow_get_state_unchecked(xcb_window_t);
uint32_t xwindow_get_state_reply(xcb_get_property_cookie_t);
void xwindow_configure(xcb_window_t, area_t, int);
void xwindow_buttons_grab(xcb_window_t, button_array_t *);
double xwindow_get_opacity(xcb_window_t);
double xwindow_get_opacity_from_reply(xcb_get_property_reply_t *);
void xwindow_set_opacity(xcb_window_t, double);
void xwindow_grabbuttons(xcb_window_t, xcb_window_t, button_array_t *);
void xwindow_grabkeys(xcb_window_t, key_array_t *);
void xwindow_takefocus(xcb_window_t);
void xwindow_set_cursor(xcb_window_t, xcb_cursor_t);
#endif
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80