From dda34421a3d586e6efd70a4a672266267dda7474 Mon Sep 17 00:00:00 2001 From: rathnor <rathnor> Date: Mon, 6 Oct 2003 06:22:43 +0000 Subject: fix shape - all menus shaped, and some weird shape bugs --- ChangeLog | 6 ++++++ src/IconbarTool.cc | 7 ++++--- src/IconbarTool.hh | 5 +++-- src/Shape.cc | 20 ++++++++------------ src/Toolbar.cc | 5 +++-- src/Toolbar.hh | 5 +++-- src/ToolbarHandler.cc | 10 ++++++---- src/ToolbarHandler.hh | 6 +++--- src/WinClient.cc | 10 +++++----- src/Window.cc | 5 +++-- src/Window.hh | 6 +++--- src/Workspace.cc | 5 +++-- src/Workspace.hh | 4 ++-- 13 files changed, 52 insertions(+), 42 deletions(-) diff --git a/ChangeLog b/ChangeLog index be3bb98..60b293b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ (Format: Year/Month/Day) Changes for 0.9.6: +*03/10/06: + * Fix shaped windows+menus (Simon) + - make sure all existing menus use shape + - fix Shape itself, particularly to work properly with borders + Shape.cc IconBarTool.hh/cc Toolbar.hh/cc ToolbarHandler.hh/cc + Window.hh/cc Workspace.hh/cc WinClient.cc *03/10/05: * Fix frame size when changing titlebar size (Simon) - also send configure notify when toggling decorations diff --git a/src/IconbarTool.cc b/src/IconbarTool.cc index a5cd936..34ca188 100644 --- a/src/IconbarTool.cc +++ b/src/IconbarTool.cc @@ -20,7 +20,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: IconbarTool.cc,v 1.12 2003/09/15 20:19:36 fluxgen Exp $ +// $Id: IconbarTool.cc,v 1.13 2003/10/06 06:22:42 rathnor Exp $ #include "IconbarTool.hh" @@ -30,7 +30,7 @@ #include "IconButton.hh" #include "Workspace.hh" #include "fluxbox.hh" - +#include "FbMenu.hh" #include "FbTk/Menu.hh" #include "FbTk/MenuItem.hh" @@ -181,7 +181,8 @@ IconbarTool::IconbarTool(const FbTk::FbWindow &parent, IconbarTheme &theme, BScr m_empty_pm(0), m_rc_mode(screen.resourceManager(), WORKSPACE, screen.name() + ".iconbar.mode", screen.altName() + ".Iconbar.Mode"), - m_menu(*screen.menuTheme(), menu.screenNumber(), screen.imageControl()) { + m_menu(*screen.menuTheme(), menu.screenNumber(), screen.imageControl(), + *screen.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())) { // setup menu setupModeMenu(m_menu, *this); diff --git a/src/IconbarTool.hh b/src/IconbarTool.hh index d80bf85..c805fec 100644 --- a/src/IconbarTool.hh +++ b/src/IconbarTool.hh @@ -20,13 +20,14 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: IconbarTool.hh,v 1.8 2003/09/10 11:08:14 fluxgen Exp $ +// $Id: IconbarTool.hh,v 1.9 2003/10/06 06:22:42 rathnor Exp $ #ifndef ICONBARTOOL_HH #define ICONBARTOOL_HH #include "ToolbarItem.hh" #include "Container.hh" +#include "FbMenu.hh" #include "FbTk/Observer.hh" #include "FbTk/Resource.hh" @@ -108,7 +109,7 @@ private: IconList m_icon_list; FbTk::Resource<Mode> m_rc_mode; - FbTk::Menu m_menu; + FbMenu m_menu; }; #endif // ICONBARTOOL_HH diff --git a/src/Shape.cc b/src/Shape.cc index 1f531e0..b4ac635 100644 --- a/src/Shape.cc +++ b/src/Shape.cc @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Shape.cc,v 1.6 2003/09/17 14:16:53 fluxgen Exp $ +// $Id: Shape.cc,v 1.7 2003/10/06 06:22:42 rathnor Exp $ #include "Shape.hh" #include "FbTk/FbWindow.hh" @@ -49,8 +49,9 @@ Pixmap createShape(FbTk::FbWindow &win, int place) { static char bottom_left_bits[] = { 0xff, 0xff, 0xfe, 0xfe, 0xfe, 0xfc, 0xf8, 0xc0 }; static char bottom_right_bits[] = { 0xff, 0xff, 0x7f, 0x7f, 0x7f, 0x3f, 0x1f, 0x03 }; - const int win_width = win.width() + 2*win.borderWidth() + 1; - const int win_height = win.height() + 2*win.borderWidth(); + const int borderw = win.borderWidth(); + const int win_width = win.width() + 2*borderw; + const int win_height = win.height() + 2*borderw; const int pixmap_width = min(8, win_width); const int pixmap_height = min(8, win_height); @@ -60,7 +61,7 @@ Pixmap createShape(FbTk::FbWindow &win, int place) { memset(data, 0xFF, data_size); XImage *ximage = XCreateImage(disp, - DefaultVisual(disp, DefaultScreen(disp)), + DefaultVisual(disp, win.screenNumber()), 1, XYPixmap, 0, data, @@ -76,7 +77,7 @@ Pixmap createShape(FbTk::FbWindow &win, int place) { if (place & Shape::TOPLEFT) { for (int y=0; y<pixmap_height; y++) { for (int x=0; x<pixmap_width; x++) { - XPutPixel(ximage, x + 1, y, (left_bits[y] & (0x01 << x)) ? 1 : 0); + XPutPixel(ximage, x, y, (left_bits[y] & (0x01 << x)) ? 1 : 0); } } } @@ -93,7 +94,7 @@ Pixmap createShape(FbTk::FbWindow &win, int place) { if (place & Shape::BOTTOMLEFT) { for (int y=0; y<pixmap_height; y++) { for (int x=0; x<pixmap_width; x++) { - XPutPixel(ximage, x + 1, y + win_height - pixmap_height, + XPutPixel(ximage, x, y + win_height - pixmap_height, (bottom_left_bits[y] & (0x01 << x)) ? 1 : 0); } } @@ -108,11 +109,6 @@ Pixmap createShape(FbTk::FbWindow &win, int place) { } } - for (int y = 0; y<pixmap_height; ++y) { - XPutPixel(ximage, 0, y, 1); - } - - Pixmap pm = XCreatePixmap(disp, win.window(), win_width, win_height, 1); FbTk::GContext gc(pm); @@ -179,7 +175,7 @@ void Shape::update() { XShapeCombineMask(FbTk::App::instance()->display(), m_win->window(), ShapeBounding, - -2, 0, + -m_win->borderWidth(), -m_win->borderWidth(), m_shape, ShapeSet); diff --git a/src/Toolbar.cc b/src/Toolbar.cc index c76b7bd..ad53499 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Toolbar.cc,v 1.122 2003/09/08 18:17:19 fluxgen Exp $ +// $Id: Toolbar.cc,v 1.123 2003/10/06 06:22:42 rathnor Exp $ #include "Toolbar.hh" @@ -224,7 +224,8 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, FbTk::Menu &menu, size_t wi m_screen(scrn), m_toolbarmenu(menu), m_placementmenu(*scrn.menuTheme(), - scrn.screenNumber(), scrn.imageControl()), + scrn.screenNumber(), scrn.imageControl(), + *scrn.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), m_layermenu(*scrn.menuTheme(), scrn.screenNumber(), scrn.imageControl(), diff --git a/src/Toolbar.hh b/src/Toolbar.hh index 719dac3..c85eb44 100644 --- a/src/Toolbar.hh +++ b/src/Toolbar.hh @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Toolbar.hh,v 1.46 2003/08/29 00:44:41 fluxgen Exp $ +// $Id: Toolbar.hh,v 1.47 2003/10/06 06:22:43 rathnor Exp $ #ifndef TOOLBAR_HH #define TOOLBAR_HH @@ -45,6 +45,7 @@ class BScreen; class Strut; +class FbMenu; class Container; class IconButton; class Shape; @@ -163,7 +164,7 @@ private: FbTk::Timer m_hide_timer; ///< timer to for auto hide toolbar FbTk::Menu &m_toolbarmenu; - FbTk::Menu m_placementmenu; + FbMenu m_placementmenu; LayerMenu<Toolbar> m_layermenu; // themes diff --git a/src/ToolbarHandler.cc b/src/ToolbarHandler.cc index f6fd015..4a8ff3d 100644 --- a/src/ToolbarHandler.cc +++ b/src/ToolbarHandler.cc @@ -20,7 +20,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: ToolbarHandler.cc,v 1.28 2003/09/08 18:18:25 fluxgen Exp $ +// $Id: ToolbarHandler.cc,v 1.29 2003/10/06 06:22:43 rathnor Exp $ /** * The ToolbarHandler class acts as a rough interface to the toolbar. @@ -33,7 +33,7 @@ #include "Screen.hh" #include "Workspace.hh" #include "MenuItem.hh" -#include "Menu.hh" +#include "FbMenu.hh" #include "FbCommands.hh" #include "RefCount.hh" #include "SimpleCommand.hh" @@ -51,9 +51,11 @@ ToolbarHandler::ToolbarHandler(BScreen &screen) m_toolbar(0), m_current_workspace(0), m_modemenu(*screen.menuTheme(), - screen.screenNumber(), screen.imageControl()), + screen.screenNumber(), screen.imageControl(), + *screen.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), m_toolbarmenu(*screen.menuTheme(), - screen.screenNumber(), screen.imageControl()) { + screen.screenNumber(), screen.imageControl(), + *screen.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())) { m_modemenu.setInternalMenu(); m_toolbarmenu.setInternalMenu(); diff --git a/src/ToolbarHandler.hh b/src/ToolbarHandler.hh index 02d131d..538ac78 100644 --- a/src/ToolbarHandler.hh +++ b/src/ToolbarHandler.hh @@ -20,7 +20,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: ToolbarHandler.hh,v 1.8 2003/09/08 18:18:25 fluxgen Exp $ +// $Id: ToolbarHandler.hh,v 1.9 2003/10/06 06:22:43 rathnor Exp $ #ifndef TOOLBARHANDLER_HH #define TOOLBARHANDLER_HH @@ -90,8 +90,8 @@ private: std::auto_ptr<Toolbar> m_toolbar; unsigned int m_current_workspace; ToolbarMode m_mode; - FbTk::Menu m_modemenu; - FbTk::Menu m_toolbarmenu; + FbMenu m_modemenu; + FbMenu m_toolbarmenu; }; #endif // TOOLBARHANDLER_HH diff --git a/src/WinClient.cc b/src/WinClient.cc index dadabe3..0e5e2e9 100644 --- a/src/WinClient.cc +++ b/src/WinClient.cc @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: WinClient.cc,v 1.29 2003/10/02 16:14:41 rathnor Exp $ +// $Id: WinClient.cc,v 1.30 2003/10/06 06:22:43 rathnor Exp $ #include "WinClient.hh" @@ -633,17 +633,17 @@ void WinClient::applySizeHints(int &width, int &height, int i = width, j = height; // Check minimum size - if (width < 0 || width < min_width) + if (width < 0 || width < static_cast<signed>(min_width)) width = min_width; - if (height < 0 || height < min_height) + if (height < 0 || height < static_cast<signed>(min_height)) height = min_height; // Check maximum size - if (max_width > 0 && width > max_width) + if (max_width > 0 && width > static_cast<signed>(max_width)) width = max_width; - if (max_height > 0 && height > max_height) + if (max_height > 0 && height > static_cast<signed>(max_height)) height = max_height; // enforce incremental size limits, wrt base size diff --git a/src/Window.cc b/src/Window.cc index ccf52a2..f7c80cd 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Window.cc,v 1.240 2003/10/05 09:03:43 rathnor Exp $ +// $Id: Window.cc,v 1.241 2003/10/06 06:22:43 rathnor Exp $ #include "Window.hh" @@ -260,7 +260,8 @@ FluxboxWindow::FluxboxWindow(WinClient &client, BScreen &scr, FbWinFrameTheme &t maximized(MAX_NONE), m_screen(scr), display(0), - m_windowmenu(*scr.menuTheme(), scr.screenNumber(), scr.imageControl()), + m_windowmenu(*scr.menuTheme(), scr.screenNumber(), scr.imageControl(), + *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), m_old_decoration(DECOR_NORMAL), m_client(&client), m_frame(new FbWinFrame(tm, scr.imageControl(), scr.screenNumber(), 0, 0, 100, 100)), diff --git a/src/Window.hh b/src/Window.hh index 8831522..480d637 100644 --- a/src/Window.hh +++ b/src/Window.hh @@ -22,13 +22,13 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Window.hh,v 1.98 2003/10/05 02:31:23 rathnor Exp $ +// $Id: Window.hh,v 1.99 2003/10/06 06:22:43 rathnor Exp $ #ifndef WINDOW_HH #define WINDOW_HH +#include "FbMenu.hh" #include "Timer.hh" -#include "Menu.hh" #include "Subject.hh" #include "EventHandler.hh" #include "XLayerItem.hh" @@ -419,7 +419,7 @@ private: Display *display; /// display connection BlackboxAttributes m_blackbox_attrib; - FbTk::Menu m_windowmenu; + FbMenu m_windowmenu; timeval m_last_focus_time; diff --git a/src/Workspace.cc b/src/Workspace.cc index 3bec41a..b0a4ab6 100644 --- a/src/Workspace.cc +++ b/src/Workspace.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Workspace.cc,v 1.81 2003/08/24 11:16:42 fluxgen Exp $ +// $Id: Workspace.cc,v 1.82 2003/10/06 06:22:43 rathnor Exp $ #include "Workspace.hh" @@ -118,7 +118,8 @@ Workspace::Workspace(BScreen &scrn, FbTk::MultLayers &layermanager, const std::string &name, unsigned int i): m_screen(scrn), m_lastfocus(0), - m_clientmenu(*scrn.menuTheme(), scrn.screenNumber(), scrn.imageControl()), + m_clientmenu(*scrn.menuTheme(), scrn.screenNumber(), scrn.imageControl(), + *scrn.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), m_layermanager(layermanager), m_name(name), m_id(i) { diff --git a/src/Workspace.hh b/src/Workspace.hh index 466b3a2..a385963 100644 --- a/src/Workspace.hh +++ b/src/Workspace.hh @@ -27,7 +27,7 @@ #include "NotCopyable.hh" -#include "Menu.hh" +#include "FbMenu.hh" #include "MultLayers.hh" #include <X11/Xlib.h> @@ -94,7 +94,7 @@ private: BScreen &m_screen; FluxboxWindow *m_lastfocus; - FbTk::Menu m_clientmenu; + FbMenu m_clientmenu; typedef std::vector<std::string> Group; typedef std::vector<Group> GroupList; -- cgit v0.11.2