fix shape - all menus shaped, and some weird shape bugs

This commit is contained in:
rathnor 2003-10-06 06:22:43 +00:00
parent 9a155ea7b5
commit dda34421a3
13 changed files with 52 additions and 42 deletions

View file

@ -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

View file

@ -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);

View file

@ -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

View file

@ -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);

View file

@ -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(),

View file

@ -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

View file

@ -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();

View file

@ -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

View file

@ -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

View file

@ -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)),

View file

@ -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;

View file

@ -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) {

View file

@ -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;