From 03e0ee53d2b1f2e7bac40255758dfd2a99c5ab6a Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Fri, 20 Aug 2010 11:26:25 +0200 Subject: [PATCH] Wibox: Remove shape support Signed-off-by: Uli Schlachter --- awesome.c | 2 - awesomeConfig.cmake | 1 - common/tokenize.gperf | 2 - lib/awful/wibox.lua.in | 52 -------------------- luadoc/wibox.lua | 2 - objects/wibox.c | 107 ----------------------------------------- objects/wibox.h | 10 ---- 7 files changed, 176 deletions(-) diff --git a/awesome.c b/awesome.c index c51636955..ab4c8d58a 100644 --- a/awesome.c +++ b/awesome.c @@ -28,7 +28,6 @@ #include #include -#include #include #include #include @@ -372,7 +371,6 @@ main(int argc, char **argv) xcb_prefetch_extension_data(globalconf.connection, &xcb_test_id); xcb_prefetch_extension_data(globalconf.connection, &xcb_randr_id); xcb_prefetch_extension_data(globalconf.connection, &xcb_xinerama_id); - xcb_prefetch_extension_data(globalconf.connection, &xcb_shape_id); /* initialize dbus */ a_dbus_init(); diff --git a/awesomeConfig.cmake b/awesomeConfig.cmake index 782404a3d..7480cefe6 100644 --- a/awesomeConfig.cmake +++ b/awesomeConfig.cmake @@ -140,7 +140,6 @@ pkg_check_modules(AWESOME_REQUIRED REQUIRED xcb-randr xcb-xtest xcb-xinerama - xcb-shape xcb-aux>=0.3.0 xcb-atom>=0.3.0 xcb-keysyms>=0.3.4 diff --git a/common/tokenize.gperf b/common/tokenize.gperf index c17b86cfa..0ba2fd91a 100644 --- a/common/tokenize.gperf +++ b/common/tokenize.gperf @@ -75,8 +75,6 @@ role screen selected session -shape_bounding -shape_clip Shift size_hints size_hints_honor diff --git a/lib/awful/wibox.lua.in b/lib/awful/wibox.lua.in index 254afb211..372d4dd90 100644 --- a/lib/awful/wibox.lua.in +++ b/lib/awful/wibox.lua.in @@ -265,58 +265,6 @@ function new(arg) return w end -local function do_rounded_corners(width, height, corner) - local img = image.argb32(width, height, nil) - - -- The image starts completely black which is fully opaque for our use - - local function transp_rect(x, y) - img:draw_rectangle(x, y, corner, corner, true, "#ffffff") - end - local function opaque_circle(x, y) - -- x, y are the center of the circle - img:draw_circle(x, y, corner, corner, true, "#000000") - end - - -- Upper left corner - -- First make a 'corner times corner' rectangle transparent - transp_rect(0, 0) - -- Then add the rounded corner - opaque_circle(corner, corner) - - -- Upper right corner - transp_rect(width - corner, 0) - opaque_circle(width - corner - 1, corner) - - -- Bottom left corner - transp_rect(0, height - corner) - opaque_circle(corner, height - corner - 1) - - -- Bottom right corner - transp_rect(width - corner, height - corner) - opaque_circle(width - corner - 1, height - corner - 1) - - return img -end - ---- Add rounded corners to a wibox --- @param wibox The wibox. --- @param corner_size The size in pixel of the rounded corners. -function rounded_corners(wibox, corner_size) - local border = wibox.border_width - - -- Corners can't be larger than half the wibox' space - if wibox.width / 2 < corner_size then - corner_size = wibox.width / 2 - end - if wibox.height / 2 < corner_size then - corner_size = wibox.height / 2 - end - - wibox.shape_clip = do_rounded_corners(wibox.width, wibox.height, corner_size) - wibox.shape_bounding = do_rounded_corners(wibox.width + border * 2, wibox.height + border * 2, corner_size + border) -end - local function update_wiboxes_on_struts(c) local struts = c:struts() if struts.left ~= 0 or struts.right ~= 0 diff --git a/luadoc/wibox.lua b/luadoc/wibox.lua index fc6a6e858..a60b5fddb 100644 --- a/luadoc/wibox.lua +++ b/luadoc/wibox.lua @@ -20,8 +20,6 @@ module("wibox") -- @field y The y coordinates. -- @field width The width of the wibox. -- @field height The height of the wibox. --- @field shape_bounding Image describing the window's border shape. --- @field shape_clip Image describing the window's content shape. -- @class table -- @name wibox diff --git a/objects/wibox.c b/objects/wibox.c index 78434236b..0b4c8c527 100644 --- a/objects/wibox.c +++ b/objects/wibox.c @@ -19,8 +19,6 @@ * */ -#include - #include "screen.h" #include "wibox.h" #include "objects/client.h" @@ -114,62 +112,6 @@ wibox_need_update(wibox_t *wibox) wibox_clear_mouse_over(wibox); } -static int -have_shape(void) -{ - const xcb_query_extension_reply_t *reply; - - reply = xcb_get_extension_data(globalconf.connection, &xcb_shape_id); - if (!reply || !reply->present) - return 0; - - /* We don't need a specific version of SHAPE, no version check required */ - return 1; -} - -static void -shape_update(xcb_window_t win, xcb_shape_kind_t kind, image_t *image, int offset) -{ - xcb_pixmap_t shape; - - if(image) - shape = image_to_1bit_pixmap(image, win); - else - /* Reset the shape */ - shape = XCB_NONE; - - xcb_shape_mask(globalconf.connection, XCB_SHAPE_SO_SET, kind, - win, offset, offset, shape); - - if (shape != XCB_NONE) - xcb_free_pixmap(globalconf.connection, shape); -} - -/** Update the window's shape. - * \param wibox The simple window whose shape should be updated. - */ -static void -wibox_shape_update(wibox_t *wibox) -{ - if(wibox->window == XCB_NONE) - return; - - if(!have_shape()) - { - static bool warned = false; - if(!warned) - warn("The X server doesn't have the SHAPE extension; " - "can't change window's shape"); - warned = true; - return; - } - - shape_update(wibox->window, XCB_SHAPE_SK_CLIP, wibox->shape.clip, 0); - shape_update(wibox->window, XCB_SHAPE_SK_BOUNDING, wibox->shape.bounding, - wibox->border_width); - - wibox->need_shape_update = false; -} - static void wibox_draw_context_update(wibox_t *w) { @@ -239,8 +181,6 @@ wibox_init(wibox_t *w) /* Update draw context physical screen, important for Zaphod. */ wibox_draw_context_update(w); - - wibox_shape_update(w); } /** Refresh the window content by copying its pixmap data to its window. @@ -584,8 +524,6 @@ wibox_refresh(void) { foreach(w, globalconf.wiboxes) { - if((*w)->need_shape_update) - wibox_shape_update(*w); if((*w)->need_update) wibox_draw(*w); } @@ -1163,41 +1101,6 @@ luaA_wibox_get_widgets(lua_State *L, wibox_t *wibox) { return luaA_object_push_item(L, 1, wibox->widgets_table); } - -static int -luaA_wibox_set_shape_bounding(lua_State *L, wibox_t *wibox) -{ - luaA_checkudata(L, -1, &image_class); - luaA_object_unref_item(L, -3, wibox->shape.bounding); - wibox->shape.bounding = luaA_object_ref_item(L, -3, -1); - wibox->need_shape_update = true; - luaA_object_emit_signal(L, -2, "property::shape_bounding", 0); - return 0; -} - -static int -luaA_wibox_get_shape_bounding(lua_State *L, wibox_t *wibox) -{ - return luaA_object_push_item(L, 1, wibox->shape.bounding); -} - -static int -luaA_wibox_set_shape_clip(lua_State *L, wibox_t *wibox) -{ - luaA_checkudata(L, -1, &image_class); - luaA_object_unref_item(L, -3, wibox->shape.clip); - wibox->shape.clip = luaA_object_ref_item(L, -3, -1); - wibox->need_shape_update = true; - luaA_object_emit_signal(L, -2, "property::shape_clip", 0); - return 0; -} - -static int -luaA_wibox_get_shape_clip(lua_State *L, wibox_t *wibox) -{ - return luaA_object_push_item(L, 1, wibox->shape.clip); -} - void wibox_class_setup(lua_State *L) { @@ -1274,14 +1177,6 @@ wibox_class_setup(lua_State *L) (lua_class_propfunc_t) luaA_wibox_set_height, (lua_class_propfunc_t) luaA_wibox_get_height, (lua_class_propfunc_t) luaA_wibox_set_height); - luaA_class_add_property(&wibox_class, A_TK_SHAPE_BOUNDING, - (lua_class_propfunc_t) luaA_wibox_set_shape_bounding, - (lua_class_propfunc_t) luaA_wibox_get_shape_bounding, - (lua_class_propfunc_t) luaA_wibox_set_shape_bounding); - luaA_class_add_property(&wibox_class, A_TK_SHAPE_CLIP, - (lua_class_propfunc_t) luaA_wibox_set_shape_clip, - (lua_class_propfunc_t) luaA_wibox_get_shape_clip, - (lua_class_propfunc_t) luaA_wibox_set_shape_clip); signal_add(&wibox_class.signals, "mouse::enter"); signal_add(&wibox_class.signals, "mouse::leave"); @@ -1294,8 +1189,6 @@ wibox_class_setup(lua_State *L) signal_add(&wibox_class.signals, "property::ontop"); signal_add(&wibox_class.signals, "property::orientation"); signal_add(&wibox_class.signals, "property::screen"); - signal_add(&wibox_class.signals, "property::shape_bounding"); - signal_add(&wibox_class.signals, "property::shape_clip"); signal_add(&wibox_class.signals, "property::visible"); signal_add(&wibox_class.signals, "property::widgets"); signal_add(&wibox_class.signals, "property::width"); diff --git a/objects/wibox.h b/objects/wibox.h index 5f0849fc4..5e365a0ad 100644 --- a/objects/wibox.h +++ b/objects/wibox.h @@ -41,8 +41,6 @@ struct wibox_t widget_t *mouse_over; /** Need update */ bool need_update; - /** Need shape update */ - bool need_shape_update; /** Cursor */ char *cursor; /** Background image */ @@ -55,14 +53,6 @@ struct wibox_t draw_context_t ctx; /** Orientation */ orientation_t orientation; - /** The window's shape */ - struct - { - /** The window's content */ - image_t *clip; - /** The window's content and border */ - image_t *bounding; - } shape; /** Has wibox an attached systray **/ bool has_systray; };