rename, remove bullshit. ya

This commit is contained in:
Dana Jansens 2002-10-31 06:54:56 +00:00
parent 60b016b7fc
commit db451d95bf
38 changed files with 124 additions and 3059 deletions

View file

@ -1,117 +0,0 @@
// -*- mode: C++; indent-tabs-mode: nil; -*-
// Netizen.cc for Blackbox - An X11 Window Manager
// Copyright (c) 2001 Sean 'Shaleh' Perry <shaleh@debian.org>
// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#ifdef HAVE_CONFIG_H
#include "../config.h"
#endif // HAVE_CONFIG_H
#include "Netizen.hh"
#include "Screen.hh"
#include "XAtom.hh"
Netizen::Netizen(BScreen *scr, Window win) {
screen = scr;
blackbox = scr->getBlackbox();
xatom = blackbox->getXAtom();
window = win;
event.type = ClientMessage;
event.xclient.message_type =
xatom->getAtom(XAtom::blackbox_structure_messages);
event.xclient.display = blackbox->getXDisplay();
event.xclient.window = window;
event.xclient.format = 32;
event.xclient.data.l[0] = xatom->getAtom(XAtom::blackbox_notify_startup);
event.xclient.data.l[1] = event.xclient.data.l[2] =
event.xclient.data.l[3] = event.xclient.data.l[4] = 0l;
XSendEvent(blackbox->getXDisplay(), window, False, NoEventMask, &event);
}
void Netizen::sendWorkspaceCount(void) {
event.xclient.data.l[0] =
xatom->getAtom(XAtom::blackbox_notify_workspace_count);
event.xclient.data.l[1] = screen->getWorkspaceCount();
XSendEvent(blackbox->getXDisplay(), window, False, NoEventMask, &event);
}
void Netizen::sendCurrentWorkspace(void) {
event.xclient.data.l[0] =
xatom->getAtom(XAtom::blackbox_notify_current_workspace);
event.xclient.data.l[1] = screen->getCurrentWorkspaceID();
XSendEvent(blackbox->getXDisplay(), window, False, NoEventMask, &event);
}
void Netizen::sendWindowFocus(Window w) {
event.xclient.data.l[0] = xatom->getAtom(XAtom::blackbox_notify_window_focus);
event.xclient.data.l[1] = w;
XSendEvent(blackbox->getXDisplay(), window, False, NoEventMask, &event);
}
void Netizen::sendWindowAdd(Window w, unsigned long p) {
event.xclient.data.l[0] = xatom->getAtom(XAtom::blackbox_notify_window_add);
event.xclient.data.l[1] = w;
event.xclient.data.l[2] = p;
XSendEvent(blackbox->getXDisplay(), window, False, NoEventMask, &event);
event.xclient.data.l[2] = 0l;
}
void Netizen::sendWindowDel(Window w) {
event.xclient.data.l[0] = xatom->getAtom(XAtom::blackbox_notify_window_del);
event.xclient.data.l[1] = w;
XSendEvent(blackbox->getXDisplay(), window, False, NoEventMask, &event);
}
void Netizen::sendWindowRaise(Window w) {
event.xclient.data.l[0] = xatom->getAtom(XAtom::blackbox_notify_window_raise);
event.xclient.data.l[1] = w;
XSendEvent(blackbox->getXDisplay(), window, False, NoEventMask, &event);
}
void Netizen::sendWindowLower(Window w) {
event.xclient.data.l[0] =
xatom->getAtom(XAtom::blackbox_notify_window_lower);
event.xclient.data.l[1] = w;
XSendEvent(blackbox->getXDisplay(), window, False, NoEventMask, &event);
}
void Netizen::sendConfigNotify(XEvent *e) {
XSendEvent(blackbox->getXDisplay(), window, False,
StructureNotifyMask, e);
}

View file

@ -1,63 +0,0 @@
// -*- mode: C++; indent-tabs-mode: nil; -*-
// Netizen.hh for Blackbox - An X11 Window Manager
// Copyright (c) 2001 Sean 'Shaleh' Perry <shaleh@debian.org>
// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#ifndef __Netizen_hh
#define __Netizen_hh
extern "C" {
#include <X11/Xlib.h>
}
// forward declaration
class Blackbox;
class BScreen;
class Netizen;
class XAtom;
class Netizen {
private:
Blackbox *blackbox;
BScreen *screen;
XAtom *xatom;
Window window;
XEvent event;
public:
Netizen(BScreen *, Window);
inline Window getWindowID(void) const { return window; }
void sendWorkspaceCount(void);
void sendCurrentWorkspace(void);
void sendWindowFocus(Window);
void sendWindowAdd(Window, unsigned long);
void sendWindowDel(Window);
void sendWindowRaise(Window);
void sendWindowLower(Window);
void sendConfigNotify(XEvent *);
};
#endif // __Netizen_hh

View file

@ -1,915 +0,0 @@
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
// Slit.cc for Blackbox - an X11 Window manager
// Copyright (c) 2001 - 2002 Sean 'Shaleh' Perry <shaleh@debian.org>
// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#ifdef HAVE_CONFIG_H
# include "../config.h"
#endif // HAVE_CONFIG_H
extern "C" {
#include <X11/keysym.h>
}
#include "i18n.hh"
#include "blackbox.hh"
#include "Image.hh"
#include "Screen.hh"
#include "Slit.hh"
#include "Toolbar.hh"
Slit::Slit(BScreen *scr) {
screen = scr;
blackbox = screen->getBlackbox();
slitstr = "session.screen" + itostring(screen->getScreenNumber()) + ".slit.";
config = blackbox->getConfig();
load_rc();
display = screen->getBaseDisplay()->getXDisplay();
frame.window = frame.pixmap = None;
timer = new BTimer(blackbox, this);
timer->setTimeout(blackbox->getAutoRaiseDelay());
slitmenu = new Slitmenu(this);
XSetWindowAttributes attrib;
unsigned long create_mask = CWBackPixmap | CWBackPixel | CWBorderPixel |
CWColormap | CWOverrideRedirect | CWEventMask;
attrib.background_pixmap = None;
attrib.background_pixel = attrib.border_pixel =
screen->getBorderColor()->pixel();
attrib.colormap = screen->getColormap();
attrib.override_redirect = True;
attrib.event_mask = SubstructureRedirectMask | ButtonPressMask |
EnterWindowMask | LeaveWindowMask;
frame.rect.setSize(1, 1);
frame.window =
XCreateWindow(display, screen->getRootWindow(),
frame.rect.x(), frame.rect.y(),
frame.rect.width(), frame.rect.height(),
screen->getBorderWidth(), screen->getDepth(), InputOutput,
screen->getVisual(), create_mask, &attrib);
blackbox->saveSlitSearch(frame.window, this);
screen->addStrut(&strut);
reconfigure();
}
Slit::~Slit(void) {
delete timer;
delete slitmenu;
screen->removeStrut(&strut);
screen->updateAvailableArea();
screen->getImageControl()->removeImage(frame.pixmap);
blackbox->removeSlitSearch(frame.window);
XDestroyWindow(display, frame.window);
}
void Slit::addClient(Window w) {
if (! blackbox->validateWindow(w))
return;
SlitClient *client = new SlitClient;
client->client_window = w;
XWMHints *wmhints = XGetWMHints(display, w);
if (wmhints) {
if ((wmhints->flags & IconWindowHint) &&
(wmhints->icon_window != None)) {
// some dock apps use separate windows, we need to hide these
XMoveWindow(display, client->client_window, screen->getWidth() + 10,
screen->getHeight() + 10);
XMapWindow(display, client->client_window);
client->icon_window = wmhints->icon_window;
client->window = client->icon_window;
} else {
client->icon_window = None;
client->window = client->client_window;
}
XFree(wmhints);
} else {
client->icon_window = None;
client->window = client->client_window;
}
XWindowAttributes attrib;
if (XGetWindowAttributes(display, client->window, &attrib)) {
client->rect.setSize(attrib.width, attrib.height);
} else {
client->rect.setSize(64, 64);
}
Atom *proto;
int num_return = 0;
if (XGetWMProtocols(display, client->window, &proto, &num_return)) {
for (int i = 0; i < num_return; ++i) {
if (proto[i] ==
blackbox->getXAtom()->getAtom(XAtom::blackbox_structure_messages)) {
screen->addNetizen(new Netizen(screen, client->window));
}
}
}
XSetWindowBorderWidth(display, client->window, 0);
XGrabServer(display);
XSelectInput(display, frame.window, NoEventMask);
XSelectInput(display, client->window, NoEventMask);
XReparentWindow(display, client->window, frame.window, 0, 0);
XMapRaised(display, client->window);
XChangeSaveSet(display, client->window, SetModeInsert);
XSelectInput(display, frame.window, SubstructureRedirectMask |
ButtonPressMask | EnterWindowMask | LeaveWindowMask);
XSelectInput(display, client->window, StructureNotifyMask |
SubstructureNotifyMask | EnterWindowMask);
XUngrabServer(display);
clientList.push_back(client);
blackbox->saveSlitSearch(client->client_window, this);
blackbox->saveSlitSearch(client->icon_window, this);
reconfigure();
}
void Slit::removeClient(SlitClient *client, bool remap) {
blackbox->removeSlitSearch(client->client_window);
blackbox->removeSlitSearch(client->icon_window);
clientList.remove(client);
screen->removeNetizen(client->window);
if (remap && blackbox->validateWindow(client->window)) {
XGrabServer(display);
XSelectInput(display, frame.window, NoEventMask);
XSelectInput(display, client->window, NoEventMask);
XReparentWindow(display, client->window, screen->getRootWindow(),
client->rect.x(), client->rect.y());
XChangeSaveSet(display, client->window, SetModeDelete);
XSelectInput(display, frame.window, SubstructureRedirectMask |
ButtonPressMask | EnterWindowMask | LeaveWindowMask);
XUngrabServer(display);
}
delete client;
client = (SlitClient *) 0;
}
struct SlitClientMatch {
Window window;
SlitClientMatch(Window w): window(w) {}
inline bool operator()(const Slit::SlitClient* client) const {
return (client->window == window);
}
};
void Slit::removeClient(Window w, bool remap) {
SlitClientList::iterator it = clientList.begin();
const SlitClientList::iterator end = clientList.end();
it = std::find_if(it, end, SlitClientMatch(w));
if (it != end) {
removeClient(*it, remap);
reconfigure();
}
}
void Slit::saveOnTop(bool b) {
on_top = b;
config->setValue(slitstr + "onTop", on_top);
}
void Slit::saveAutoHide(bool b) {
do_auto_hide = b;
config->setValue(slitstr + "autoHide", do_auto_hide);
}
void Slit::savePlacement(int p) {
placement = p;
const char *pname;
switch (placement) {
case TopLeft: pname = "TopLeft"; break;
case CenterLeft: pname = "CenterLeft"; break;
case BottomLeft: pname = "BottomLeft"; break;
case TopCenter: pname = "TopCenter"; break;
case BottomCenter: pname = "BottomCenter"; break;
case TopRight: pname = "TopRight"; break;
case BottomRight: pname = "BottomRight"; break;
case CenterRight: default: pname = "CenterRight"; break;
}
config->setValue(slitstr + "placement", pname);
}
void Slit::saveDirection(int d) {
direction = d;
config->setValue(slitstr + "direction", (direction == Horizontal ?
"Horizontal" : "Vertical"));
}
void Slit::save_rc(void) {
saveOnTop(on_top);
saveAutoHide(do_auto_hide);
savePlacement(placement);
saveDirection(direction);
}
void Slit::load_rc(void) {
std::string s;
if (! config->getValue(slitstr + "onTop", on_top))
on_top = false;
if (! config->getValue(slitstr + "autoHide", do_auto_hide))
do_auto_hide = false;
hidden = do_auto_hide;
if (config->getValue(slitstr + "direction", s) && s == "Horizontal")
direction = Horizontal;
else
direction = Vertical;
if (config->getValue(slitstr + "placement", s)) {
if (s == "TopLeft")
placement = TopLeft;
else if (s == "CenterLeft")
placement = CenterLeft;
else if (s == "BottomLeft")
placement = BottomLeft;
else if (s == "TopCenter")
placement = TopCenter;
else if (s == "BottomCenter")
placement = BottomCenter;
else if (s == "TopRight")
placement = TopRight;
else if (s == "BottomRight")
placement = BottomRight;
else //if (s == "CenterRight")
placement = CenterRight;
} else
placement = CenterRight;
}
void Slit::reconfigure(void) {
SlitClientList::iterator it = clientList.begin();
const SlitClientList::iterator end = clientList.end();
SlitClient *client;
unsigned int width = 0, height = 0;
switch (direction) {
case Vertical:
for (; it != end; ++it) {
client = *it;
height += client->rect.height() + screen->getBevelWidth();
if (width < client->rect.width())
width = client->rect.width();
}
if (width < 1)
width = 1;
else
width += (screen->getBevelWidth() * 2);
if (height < 1)
height = 1;
else
height += screen->getBevelWidth();
break;
case Horizontal:
for (; it != end; ++it) {
client = *it;
width += client->rect.width() + screen->getBevelWidth();
if (height < client->rect.height())
height = client->rect.height();
}
if (width < 1)
width = 1;
else
width += screen->getBevelWidth();
if (height < 1)
height = 1;
else
height += (screen->getBevelWidth() * 2);
break;
}
frame.rect.setSize(width, height);
reposition();
XSetWindowBorderWidth(display ,frame.window, screen->getBorderWidth());
XSetWindowBorder(display, frame.window,
screen->getBorderColor()->pixel());
if (clientList.empty())
XUnmapWindow(display, frame.window);
else
XMapWindow(display, frame.window);
BTexture *texture = &(screen->getToolbarStyle()->toolbar);
frame.pixmap = texture->render(frame.rect.width(), frame.rect.height(),
frame.pixmap);
if (! frame.pixmap)
XSetWindowBackground(display, frame.window, texture->color().pixel());
else
XSetWindowBackgroundPixmap(display, frame.window, frame.pixmap);
XClearWindow(display, frame.window);
it = clientList.begin();
int x, y;
switch (direction) {
case Vertical:
x = 0;
y = screen->getBevelWidth();
for (; it != end; ++it) {
client = *it;
x = (frame.rect.width() - client->rect.width()) / 2;
XMoveResizeWindow(display, client->window, x, y,
client->rect.width(), client->rect.height());
XMapWindow(display, client->window);
// for ICCCM compliance
client->rect.setPos(x, y);
XEvent event;
event.type = ConfigureNotify;
event.xconfigure.display = display;
event.xconfigure.event = client->window;
event.xconfigure.window = client->window;
event.xconfigure.x = x;
event.xconfigure.y = y;
event.xconfigure.width = client->rect.width();
event.xconfigure.height = client->rect.height();
event.xconfigure.border_width = 0;
event.xconfigure.above = frame.window;
event.xconfigure.override_redirect = False;
XSendEvent(display, client->window, False, StructureNotifyMask, &event);
y += client->rect.height() + screen->getBevelWidth();
}
break;
case Horizontal:
x = screen->getBevelWidth();
y = 0;
for (; it != end; ++it) {
client = *it;
y = (frame.rect.height() - client->rect.height()) / 2;
XMoveResizeWindow(display, client->window, x, y,
client->rect.width(), client->rect.height());
XMapWindow(display, client->window);
// for ICCCM compliance
client->rect.setPos(x, y);
XEvent event;
event.type = ConfigureNotify;
event.xconfigure.display = display;
event.xconfigure.event = client->window;
event.xconfigure.window = client->window;
event.xconfigure.x = x;
event.xconfigure.y = y;
event.xconfigure.width = client->rect.width();
event.xconfigure.height = client->rect.height();
event.xconfigure.border_width = 0;
event.xconfigure.above = frame.window;
event.xconfigure.override_redirect = False;
XSendEvent(display, client->window, False, StructureNotifyMask, &event);
x += client->rect.width() + screen->getBevelWidth();
}
break;
}
slitmenu->reconfigure();
}
void Slit::updateStrut(void) {
strut.top = strut.bottom = strut.left = strut.right = 0;
if (! clientList.empty()) {
// when not hidden both borders are in use, when hidden only one is
unsigned int border_width = screen->getBorderWidth();
if (! do_auto_hide)
border_width *= 2;
switch (direction) {
case Vertical:
switch (placement) {
case TopCenter:
strut.top = getExposedHeight() + border_width;
break;
case BottomCenter:
strut.bottom = getExposedHeight() + border_width;
break;
case TopLeft:
case CenterLeft:
case BottomLeft:
strut.left = getExposedWidth() + border_width;
break;
case TopRight:
case CenterRight:
case BottomRight:
strut.right = getExposedWidth() + border_width;
break;
}
break;
case Horizontal:
switch (placement) {
case TopCenter:
case TopLeft:
case TopRight:
strut.top = frame.rect.top() + getExposedHeight() + border_width;
break;
case BottomCenter:
case BottomLeft:
case BottomRight:
int pos;
if (do_auto_hide)
pos = frame.y_hidden;
else
pos = frame.rect.y();
strut.bottom = (screen->getRect().bottom() - pos);
break;
case CenterLeft:
strut.left = getExposedWidth() + border_width;
break;
case CenterRight:
strut.right = getExposedWidth() + border_width;
break;
}
break;
}
}
// update area with new Strut info
screen->updateAvailableArea();
}
void Slit::reposition(void) {
int x = 0, y = 0;
switch (placement) {
case TopLeft:
case CenterLeft:
case BottomLeft:
x = 0;
frame.x_hidden = screen->getBevelWidth() - screen->getBorderWidth()
- frame.rect.width();
if (placement == TopLeft)
y = 0;
else if (placement == CenterLeft)
y = (screen->getHeight() - frame.rect.height()) / 2;
else
y = screen->getHeight() - frame.rect.height()
- (screen->getBorderWidth() * 2);
break;
case TopCenter:
case BottomCenter:
x = (screen->getWidth() - frame.rect.width()) / 2;
frame.x_hidden = x;
if (placement == TopCenter)
y = 0;
else
y = screen->getHeight() - frame.rect.height()
- (screen->getBorderWidth() * 2);
break;
case TopRight:
case CenterRight:
case BottomRight:
x = screen->getWidth() - frame.rect.width()
- (screen->getBorderWidth() * 2);
frame.x_hidden = screen->getWidth() - screen->getBevelWidth()
- screen->getBorderWidth();
if (placement == TopRight)
y = 0;
else if (placement == CenterRight)
y = (screen->getHeight() - frame.rect.height()) / 2;
else
y = screen->getHeight() - frame.rect.height()
- (screen->getBorderWidth() * 2);
break;
}
frame.rect.setPos(x, y);
// we have to add the border to the rect as it is not accounted for
Rect tbar_rect = screen->getToolbar()->getRect();
tbar_rect.setSize(tbar_rect.width() + (screen->getBorderWidth() * 2),
tbar_rect.height() + (screen->getBorderWidth() * 2));
Rect slit_rect = frame.rect;
slit_rect.setSize(slit_rect.width() + (screen->getBorderWidth() * 2),
slit_rect.height() + (screen->getBorderWidth() * 2));
if (! screen->doHideToolbar() && slit_rect.intersects(tbar_rect)) {
int delta = screen->getToolbar()->getExposedHeight() +
screen->getBorderWidth();
if (frame.rect.bottom() <= tbar_rect.bottom())
delta = -delta;
frame.rect.setY(frame.rect.y() + delta);
}
if (placement == TopCenter)
frame.y_hidden = 0 - frame.rect.height() + screen->getBorderWidth()
+ screen->getBevelWidth();
else if (placement == BottomCenter)
frame.y_hidden = screen->getHeight() - screen->getBorderWidth()
- screen->getBevelWidth();
else
frame.y_hidden = frame.rect.y();
updateStrut();
if (hidden)
XMoveResizeWindow(display, frame.window,
frame.x_hidden, frame.y_hidden,
frame.rect.width(), frame.rect.height());
else
XMoveResizeWindow(display, frame.window,
frame.rect.x(), frame.rect.y(),
frame.rect.width(), frame.rect.height());
}
void Slit::shutdown(void) {
while (! clientList.empty())
removeClient(clientList.front());
}
void Slit::buttonPressEvent(const XButtonEvent *e) {
if (e->window != frame.window) return;
if (e->button == Button1 && (! on_top)) {
Window w[1] = { frame.window };
screen->raiseWindows(w, 1);
} else if (e->button == Button2 && (! on_top)) {
XLowerWindow(display, frame.window);
} else if (e->button == Button3) {
if (! slitmenu->isVisible()) {
int x, y;
x = e->x_root - (slitmenu->getWidth() / 2);
y = e->y_root - (slitmenu->getHeight() / 2);
if (x < 0)
x = 0;
else if (x + slitmenu->getWidth() > screen->getWidth())
x = screen->getWidth() - slitmenu->getWidth();
if (y < 0)
y = 0;
else if (y + slitmenu->getHeight() > screen->getHeight())
y = screen->getHeight() - slitmenu->getHeight();
slitmenu->move(x, y);
slitmenu->show();
} else {
slitmenu->hide();
}
}
}
void Slit::enterNotifyEvent(const XCrossingEvent *) {
if (! do_auto_hide)
return;
if (hidden) {
if (! timer->isTiming()) timer->start();
} else {
if (timer->isTiming()) timer->stop();
}
}
void Slit::leaveNotifyEvent(const XCrossingEvent *) {
if (! do_auto_hide)
return;
if (hidden) {
if (timer->isTiming()) timer->stop();
} else if (! slitmenu->isVisible()) {
if (! timer->isTiming()) timer->start();
}
}
void Slit::configureRequestEvent(const XConfigureRequestEvent *e) {
if (! blackbox->validateWindow(e->window))
return;
XWindowChanges xwc;
xwc.x = e->x;
xwc.y = e->y;
xwc.width = e->width;
xwc.height = e->height;
xwc.border_width = 0;
xwc.sibling = e->above;
xwc.stack_mode = e->detail;
XConfigureWindow(display, e->window, e->value_mask, &xwc);
SlitClientList::iterator it = clientList.begin();
const SlitClientList::iterator end = clientList.end();
for (; it != end; ++it) {
SlitClient *client = *it;
if (client->window == e->window &&
(static_cast<signed>(client->rect.width()) != e->width ||
static_cast<signed>(client->rect.height()) != e->height)) {
client->rect.setSize(e->width, e->height);
reconfigure();
return;
}
}
}
void Slit::timeout(void) {
hidden = ! hidden;
if (hidden)
XMoveWindow(display, frame.window, frame.x_hidden, frame.y_hidden);
else
XMoveWindow(display, frame.window, frame.rect.x(), frame.rect.y());
}
void Slit::toggleAutoHide(void) {
saveAutoHide(do_auto_hide ? False : True);
updateStrut();
if (do_auto_hide == False && hidden) {
// force the slit to be visible
if (timer->isTiming()) timer->stop();
timeout();
}
}
void Slit::unmapNotifyEvent(const XUnmapEvent *e) {
removeClient(e->window);
}
Slitmenu::Slitmenu(Slit *sl) : Basemenu(sl->screen) {
slit = sl;
setLabel(i18n(SlitSet, SlitSlitTitle, "Slit"));
setInternalMenu();
directionmenu = new Directionmenu(this);
placementmenu = new Placementmenu(this);
insert(i18n(CommonSet, CommonDirectionTitle, "Direction"),
directionmenu);
insert(i18n(CommonSet, CommonPlacementTitle, "Placement"),
placementmenu);
insert(i18n(CommonSet, CommonAlwaysOnTop, "Always on top"), 1);
insert(i18n(CommonSet, CommonAutoHide, "Auto hide"), 2);
update();
if (slit->isOnTop()) setItemSelected(2, True);
if (slit->doAutoHide()) setItemSelected(3, True);
}
Slitmenu::~Slitmenu(void) {
delete directionmenu;
delete placementmenu;
}
void Slitmenu::itemSelected(int button, unsigned int index) {
if (button != 1)
return;
BasemenuItem *item = find(index);
if (! item) return;
switch (item->function()) {
case 1: { // always on top
slit->saveOnTop(! slit->isOnTop());
setItemSelected(2, slit->isOnTop());
if (slit->isOnTop()) slit->screen->raiseWindows((Window *) 0, 0);
break;
}
case 2: { // auto hide
slit->toggleAutoHide();
setItemSelected(3, slit->doAutoHide());
break;
}
} // switch
}
void Slitmenu::internal_hide(void) {
Basemenu::internal_hide();
if (slit->doAutoHide())
slit->timeout();
}
void Slitmenu::reconfigure(void) {
directionmenu->reconfigure();
placementmenu->reconfigure();
Basemenu::reconfigure();
}
Slitmenu::Directionmenu::Directionmenu(Slitmenu *sm)
: Basemenu(sm->slit->screen), slit(sm->slit) {
setLabel(i18n(SlitSet, SlitSlitDirection, "Slit Direction"));
setInternalMenu();
insert(i18n(CommonSet, CommonDirectionHoriz, "Horizontal"),
Slit::Horizontal);
insert(i18n(CommonSet, CommonDirectionVert, "Vertical"),
Slit::Vertical);
update();
setValues();
}
void Slitmenu::Directionmenu::reconfigure(void) {
setValues();
Basemenu::reconfigure();
}
void Slitmenu::Directionmenu::setValues(void) {
const bool horiz = slit->getDirection() == Slit::Horizontal;
setItemSelected(0, horiz);
setItemSelected(1, ! horiz);
}
void Slitmenu::Directionmenu::itemSelected(int button, unsigned int index) {
if (button != 1)
return;
BasemenuItem *item = find(index);
if (! item) return;
slit->saveDirection(item->function());
hide();
slit->reconfigure();
}
Slitmenu::Placementmenu::Placementmenu(Slitmenu *sm)
: Basemenu(sm->slit->screen), slit(sm->slit) {
setLabel(i18n(SlitSet, SlitSlitPlacement, "Slit Placement"));
setMinimumSublevels(3);
setInternalMenu();
insert(i18n(CommonSet, CommonPlacementTopLeft, "Top Left"),
Slit::TopLeft);
insert(i18n(CommonSet, CommonPlacementCenterLeft, "Center Left"),
Slit::CenterLeft);
insert(i18n(CommonSet, CommonPlacementBottomLeft, "Bottom Left"),
Slit::BottomLeft);
insert(i18n(CommonSet, CommonPlacementTopCenter, "Top Center"),
Slit::TopCenter);
insert("");
insert(i18n(CommonSet, CommonPlacementBottomCenter, "Bottom Center"),
Slit::BottomCenter);
insert(i18n(CommonSet, CommonPlacementTopRight, "Top Right"),
Slit::TopRight);
insert(i18n(CommonSet, CommonPlacementCenterRight, "Center Right"),
Slit::CenterRight);
insert(i18n(CommonSet, CommonPlacementBottomRight, "Bottom Right"),
Slit::BottomRight);
update();
setValues();
}
void Slitmenu::Placementmenu::reconfigure(void) {
setValues();
Basemenu::reconfigure();
}
void Slitmenu::Placementmenu::setValues(void) {
int place = 0;
switch (slit->getPlacement()) {
case Slit::BottomRight:
place++;
case Slit::CenterRight:
place++;
case Slit::TopRight:
place++;
case Slit::BottomCenter:
place++;
case Slit::TopCenter:
place++;
case Slit::BottomLeft:
place++;
case Slit::CenterLeft:
place++;
case Slit::TopLeft:
break;
}
setItemSelected(0, 0 == place);
setItemSelected(1, 1 == place);
setItemSelected(2, 2 == place);
setItemSelected(3, 3 == place);
setItemSelected(5, 4 == place);
setItemSelected(6, 5 == place);
setItemSelected(7, 6 == place);
setItemSelected(8, 7 == place);
}
void Slitmenu::Placementmenu::itemSelected(int button, unsigned int index) {
if (button != 1)
return;
BasemenuItem *item = find(index);
if (! (item && item->function())) return;
slit->savePlacement(item->function());
hide();
slit->reconfigure();
}

View file

@ -1,205 +0,0 @@
// -*- mode: C++; indent-tabs-mode: nil; -*-
// Slit.hh for Blackbox - an X11 Window manager
// Copyright (c) 2001 - 2002 Sean 'Shaleh' Perry <shaleh@debian.org>
// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#ifndef __Slit_hh
#define __Slit_hh
extern "C" {
#include <X11/Xlib.h>
#include <X11/Xutil.h>
}
#include <list>
#include <string>
#include "Screen.hh"
#include "Basemenu.hh"
// forward declaration
class Slit;
class Slitmenu;
class Slitmenu : public Basemenu {
private:
class Directionmenu : public Basemenu {
private:
Directionmenu(const Directionmenu&);
Directionmenu& operator=(const Directionmenu&);
Slit *slit;
protected:
virtual void itemSelected(int button, unsigned int index);
virtual void setValues(void);
public:
Directionmenu(Slitmenu *sm);
virtual void reconfigure(void);
};
class Placementmenu : public Basemenu {
private:
Placementmenu(const Placementmenu&);
Placementmenu& operator=(const Placementmenu&);
Slit *slit;
protected:
virtual void itemSelected(int buton, unsigned int index);
virtual void setValues(void);
public:
Placementmenu(Slitmenu *sm);
virtual void reconfigure(void);
};
Directionmenu *directionmenu;
Placementmenu *placementmenu;
Slit *slit;
friend class Directionmenu;
friend class Placementmenu;
friend class Slit;
Slitmenu(const Slitmenu&);
Slitmenu& operator=(const Slitmenu&);
protected:
virtual void itemSelected(int button, unsigned int index);
virtual void internal_hide(void);
public:
Slitmenu(Slit *sl);
virtual ~Slitmenu(void);
inline Basemenu *getDirectionmenu(void) { return directionmenu; }
inline Basemenu *getPlacementmenu(void) { return placementmenu; }
void reconfigure(void);
};
class Slit : public TimeoutHandler {
public:
struct SlitClient {
Window window, client_window, icon_window;
Rect rect;
};
private:
typedef std::list<SlitClient*> SlitClientList;
bool on_top, hidden, do_auto_hide;
int direction, placement;
std::string slitstr;
Display *display;
Blackbox *blackbox;
BScreen *screen;
Configuration *config;
BTimer *timer;
Strut strut;
SlitClientList clientList;
Slitmenu *slitmenu;
struct SlitFrame {
Pixmap pixmap;
Window window;
int x_hidden, y_hidden;
Rect rect;
} frame;
void updateStrut(void);
friend class Slitmenu;
friend class Slitmenu::Directionmenu;
friend class Slitmenu::Placementmenu;
Slit(const Slit&);
Slit& operator=(const Slit&);
public:
Slit(BScreen *scr);
virtual ~Slit(void);
inline bool isOnTop(void) const { return on_top; }
inline bool isHidden(void) const { return hidden; }
inline bool doAutoHide(void) const { return do_auto_hide; }
inline int getPlacement(void) const { return placement; }
inline int getDirection(void) const { return direction; }
void saveOnTop(bool);
void saveAutoHide(bool);
void savePlacement(int);
void saveDirection(int);
inline Slitmenu *getMenu(void) { return slitmenu; }
inline Window getWindowID(void) const { return frame.window; }
inline int getX(void) const
{ return ((hidden) ? frame.x_hidden : frame.rect.x()); }
inline int getY(void) const
{ return ((hidden) ? frame.y_hidden : frame.rect.y()); }
inline unsigned int getWidth(void) const { return frame.rect.width(); }
inline unsigned int getExposedWidth(void) const {
if (direction == Vertical && do_auto_hide)
return screen->getBevelWidth();
return frame.rect.width();
}
inline unsigned int getHeight(void) const { return frame.rect.height(); }
inline unsigned int getExposedHeight(void) const {
if (direction == Horizontal && do_auto_hide)
return screen->getBevelWidth();
return frame.rect.height();
}
void addClient(Window w);
void removeClient(SlitClient *client, bool remap = True);
void removeClient(Window w, bool remap = True);
void load_rc(void);
void save_rc(void);
void reconfigure(void);
void updateSlit(void);
void reposition(void);
void shutdown(void);
void toggleAutoHide(void);
void buttonPressEvent(const XButtonEvent *e);
void enterNotifyEvent(const XCrossingEvent * /*unused*/);
void leaveNotifyEvent(const XCrossingEvent * /*unused*/);
void configureRequestEvent(const XConfigureRequestEvent *e);
void unmapNotifyEvent(const XUnmapEvent *e);
virtual void timeout(void);
enum { Vertical = 1, Horizontal };
enum { TopLeft = 1, CenterLeft, BottomLeft, TopCenter, BottomCenter,
TopRight, CenterRight, BottomRight };
};
#endif // __Slit_hh

File diff suppressed because it is too large Load diff

View file

@ -1,197 +0,0 @@
// -*- mode: C++; indent-tabs-mode: nil; -*-
// Toolbar.hh for Blackbox - an X11 Window manager
// Copyright (c) 2001 - 2002 Sean 'Shaleh' Perry <shaleh@debian.org>
// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#ifndef __Toolbar_hh
#define __Toolbar_hh
extern "C" {
#include <X11/Xlib.h>
}
#include "Screen.hh"
#include "Basemenu.hh"
#include "Timer.hh"
// forward declaration
class Toolbar;
class Toolbarmenu : public Basemenu {
private:
class Placementmenu : public Basemenu {
private:
Placementmenu(const Placementmenu&);
Placementmenu& operator=(const Placementmenu&);
Toolbar *toolbar;
protected:
virtual void itemSelected(int button, unsigned int index);
virtual void setValues(void);
public:
Placementmenu(Toolbarmenu *tm);
virtual void reconfigure(void);
};
Toolbar *toolbar;
Placementmenu *placementmenu;
friend class Placementmenu;
friend class Toolbar;
Toolbarmenu(const Toolbarmenu&);
Toolbarmenu& operator=(const Toolbarmenu&);
protected:
virtual void itemSelected(int button, unsigned int index);
virtual void internal_hide(void);
virtual void setValues(void);
public:
Toolbarmenu(Toolbar *tb);
~Toolbarmenu(void);
inline Basemenu *getPlacementmenu(void) { return placementmenu; }
virtual void reconfigure(void);
};
class Toolbar : public TimeoutHandler {
private:
bool on_top, editing, hidden, do_auto_hide;
unsigned int width_percent;
int placement;
std::string toolbarstr;
Display *display;
struct ToolbarFrame {
unsigned long button_pixel, pbutton_pixel;
Pixmap base, label, wlabel, clk, button, pbutton;
Window window, workspace_label, window_label, clock, psbutton, nsbutton,
pwbutton, nwbutton;
int x_hidden, y_hidden, hour, minute;
unsigned int window_label_w, workspace_label_w, clock_w,
button_w, bevel_w, label_h;
Rect rect;
} frame;
class HideHandler : public TimeoutHandler {
public:
Toolbar *toolbar;
virtual void timeout(void);
} hide_handler;
Blackbox *blackbox;
BScreen *screen;
Configuration *config;
BTimer *clock_timer, *hide_timer;
Toolbarmenu *toolbarmenu;
Strut strut;
std::string new_workspace_name;
size_t new_name_pos;
friend class HideHandler;
friend class Toolbarmenu;
friend class Toolbarmenu::Placementmenu;
void drawArrow(Drawable surface, bool left) const;
void redrawPrevWorkspaceButton(bool pressed = False, bool redraw = False);
void redrawNextWorkspaceButton(bool pressed = False, bool redraw = False);
void redrawPrevWindowButton(bool preseed = False, bool redraw = False);
void redrawNextWindowButton(bool preseed = False, bool redraw = False);
void updateStrut(void);
#ifdef HAVE_STRFTIME
void checkClock(bool redraw = False);
#else // HAVE_STRFTIME
void checkClock(bool redraw = False, bool date = False);
#endif // HAVE_STRFTIME
Toolbar(const Toolbar&);
Toolbar& operator=(const Toolbar&);
public:
Toolbar(BScreen *scrn);
virtual ~Toolbar(void);
inline Toolbarmenu *getMenu(void) { return toolbarmenu; }
inline bool isEditing(void) const { return editing; }
inline bool isOnTop(void) const { return on_top; }
inline bool isHidden(void) const { return hidden; }
inline bool doAutoHide(void) const { return do_auto_hide; }
inline unsigned int getWidthPercent(void) const { return width_percent; }
inline int getPlacement(void) const { return placement; }
void saveOnTop(bool);
void saveAutoHide(bool);
void saveWidthPercent(unsigned int);
void savePlacement(int);
void save_rc(void);
void load_rc(void);
void mapToolbar(void);
void unmapToolbar(void);
inline Window getWindowID(void) const { return frame.window; }
inline const Rect& getRect(void) const { return frame.rect; }
inline unsigned int getWidth(void) const { return frame.rect.width(); }
inline unsigned int getHeight(void) const { return frame.rect.height(); }
inline unsigned int getExposedHeight(void) const
{ return (screen->doHideToolbar() ? 0 :
((do_auto_hide) ? frame.bevel_w :
frame.rect.height())); }
inline int getX(void) const
{ return ((hidden) ? frame.x_hidden : frame.rect.x()); }
inline int getY(void) const
{ return ((hidden) ? frame.y_hidden : frame.rect.y()); }
void buttonPressEvent(const XButtonEvent *be);
void buttonReleaseEvent(const XButtonEvent *re);
void enterNotifyEvent(const XCrossingEvent * /*unused*/);
void leaveNotifyEvent(const XCrossingEvent * /*unused*/);
void exposeEvent(const XExposeEvent *ee);
void keyPressEvent(const XKeyEvent *ke);
void edit(void);
void reconfigure(void);
void toggleAutoHide(void);
void redrawWindowLabel(bool redraw = False);
void redrawWorkspaceLabel(bool redraw = False);
virtual void timeout(void);
enum { TopLeft = 1, BottomLeft, TopCenter,
BottomCenter, TopRight, BottomRight };
};
#endif // __Toolbar_hh

View file

@ -85,11 +85,10 @@ extern "C" {
#include <string>
using std::string;
#include "i18n.hh"
#include "BaseDisplay.hh"
#include "GCCache.hh"
#include "Timer.hh"
#include "Util.hh"
#include "basedisplay.hh"
#include "gccache.hh"
#include "timer.hh"
#include "util.hh"
// X error handler to handle any and all X errors while the application is

View file

@ -36,8 +36,8 @@ extern "C" {
class BaseDisplay;
class BGCCache;
#include "Timer.hh"
#include "Util.hh"
#include "timer.hh"
#include "util.hh"
class ScreenInfo {
private:

View file

@ -96,21 +96,20 @@ extern "C" {
#include <string>
using std::string;
#include "i18n.hh"
#include "blackbox.hh"
#include "Basemenu.hh"
#include "Clientmenu.hh"
#include "GCCache.hh"
#include "Image.hh"
#include "Rootmenu.hh"
#include "Screen.hh"
#include "Slit.hh"
#include "Toolbar.hh"
#include "Util.hh"
#include "Window.hh"
#include "Workspace.hh"
#include "Workspacemenu.hh"
#include "XAtom.hh"
#include "basemenu.hh"
#include "clientmenu.hh"
#include "gccache.hh"
#include "image.hh"
#include "rootmenu.hh"
#include "screen.hh"
#include "slit.hh"
#include "toolbar.hh"
#include "util.hh"
#include "window.hh"
#include "workspace.hh"
#include "workspacemenu.hh"
#include "xatom.hh"
Blackbox *blackbox;

View file

@ -47,11 +47,10 @@ extern "C" {
#include <map>
#include <string>
#include "i18n.hh"
#include "BaseDisplay.hh"
#include "Configuration.hh"
#include "Timer.hh"
#include "XAtom.hh"
#include "basedisplay.hh"
#include "configuration.hh"
#include "timer.hh"
#include "xatom.hh"
#define AttribShaded (1l << 0)
#define AttribMaxHoriz (1l << 1)

View file

@ -31,8 +31,8 @@ extern "C" {
#include <assert.h>
#include "Color.hh"
#include "BaseDisplay.hh"
#include "color.hh"
#include "basedisplay.hh"
BColor::ColorCache BColor::colorcache;

View file

@ -30,8 +30,8 @@ extern "C" {
#endif // HAVE_STDLIB_H
}
#include "Configuration.hh"
#include "Util.hh"
#include "configuration.hh"
#include "util.hh"
#include <algorithm>

View file

@ -38,18 +38,17 @@ using std::string;
using std::cerr;
using std::endl;
#include "i18n.hh"
#include "Font.hh"
#include "Util.hh"
#include "GCCache.hh"
#include "Color.hh"
#include "font.hh"
#include "util.hh"
#include "gccache.hh"
#include "color.hh"
string BFont::_fallback_font = "fixed";
#ifdef XFT
BFont::BFont(Display *d, BScreen *screen, const string &family, int size,
bool bold, bool italic, bool shadow, unsigned char offset,
int tint, bool antialias) :
unsigned char tint, bool antialias) :
_display(d),
_screen(screen),
_family(family),
@ -265,22 +264,14 @@ void BFont::drawString(Drawable d, int x, int y, const BColor &color,
_screen->getColormap());
assert(draw);
if (_shadow) {
XftColor c;
if (_tint >= 0) {
c.color.red = 0;
c.color.green = 0;
c.color.blue = 0;
c.color.alpha = 0xffff * _tint/100; // transparent shadow
c.pixel = BlackPixel(_display, _screen->getScreenNumber());
} else {
c.color.red = 0xffff * -_tint/100;
c.color.green = 0xffff * -_tint/100;
c.color.blue = 0xffff * -_tint/100;
c.color.alpha = 0xffff * -_tint/100;
c.pixel = WhitePixel(_display, _screen->getScreenNumber());
}
c.color.red = 0;
c.color.green = 0;
c.color.blue = 0;
c.color.alpha = _tint | _tint << 8; // transparent shadow
c.pixel = BlackPixel(_display, _screen->getScreenNumber());
#ifdef XFT_UTF8
XftDrawStringUtf8(
#else

View file

@ -40,7 +40,7 @@ class BGCCache;
class BGCCacheItem;
class BColor;
#include "Screen.hh"
#include "screen.hh"
class BFont {
/*
@ -73,7 +73,7 @@ private:
bool _antialias;
bool _shadow;
unsigned char _offset;
int _tint;
unsigned char _tint;
XftFont *_xftfont;
@ -99,7 +99,7 @@ public:
// loads an Xft font
BFont(Display *d, BScreen *screen, const std::string &family, int size,
bool bold, bool italic, bool shadow, unsigned char offset,
int tint, bool antialias = True);
unsigned char tint, bool antialias = True);
#endif
// loads a standard X font
BFont(Display *d, BScreen *screen, const std::string &xlfd);

View file

@ -29,10 +29,10 @@ extern "C" {
#include <stdio.h>
}
#include "GCCache.hh"
#include "BaseDisplay.hh"
#include "Color.hh"
#include "Util.hh"
#include "gccache.hh"
#include "basedisplay.hh"
#include "color.hh"
#include "util.hh"
BGCCacheContext::~BGCCacheContext(void) {

View file

@ -28,8 +28,8 @@ extern "C" {
#include <X11/Xlib.h>
}
#include "BaseDisplay.hh"
#include "Color.hh"
#include "basedisplay.hh"
#include "color.hh"
class BGCCacheItem;

View file

@ -1,119 +0,0 @@
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
// i18n.cc for Blackbox - an X11 Window manager
// Copyright (c) 2001 - 2002 Sean 'Shaleh' Perry <shaleh@debian.org>
// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#ifdef HAVE_CONFIG_H
# include "../config.h"
#endif // HAVE_CONFIG_H
extern "C" {
#include <X11/Xlocale.h>
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif // HAVE_STDLIB_H
#ifdef HAVE_STRING_H
# include <string.h>
#endif // HAVE_STRING_H
#ifdef HAVE_STDIO_H
# include <stdio.h>
#endif // HAVE_STDIO_H
#ifdef HAVE_LOCALE_H
# include <locale.h>
#endif // HAVE_LOCALE_H
}
#include <string>
using std::string;
#include "i18n.hh"
// the rest of bb source uses True and False from X, so we continue that
#define True true
#define False false
I18n::I18n(void) {
mb = False;
#ifdef HAVE_SETLOCALE
locale = setlocale(LC_ALL, "");
if (! locale) {
fprintf(stderr, "failed to set locale, reverting to \"C\"\n");
#endif // HAVE_SETLOCALE
locale = "C";
#ifdef HAVE_SETLOCALE
} else {
// MB_CUR_MAX returns the size of a char in the current locale
if (MB_CUR_MAX > 1)
mb = True;
// truncate any encoding off the end of the locale
char *l = strchr(locale, '@');
if (l) *l = '\0';
l = strchr(locale, '.');
if (l) *l = '\0';
}
#ifdef HAVE_CATOPEN
catalog_fd = (nl_catd) -1;
#endif
#endif // HAVE_SETLOCALE
}
I18n::~I18n(void) {
#if defined(NLS) && defined(HAVE_CATCLOSE)
if (catalog_fd != (nl_catd) -1)
catclose(catalog_fd);
#endif // HAVE_CATCLOSE
}
void I18n::openCatalog(const char *catalog) {
#if defined(NLS) && defined(HAVE_CATOPEN)
string catalog_filename = LOCALEPATH;
catalog_filename += '/';
catalog_filename += locale;
catalog_filename += '/';
catalog_filename += catalog;
# ifdef MCLoadBySet
catalog_fd = catopen(catalog_filename.c_str(), MCLoadBySet);
# else // !MCLoadBySet
catalog_fd = catopen(catalog_filename.c_str(), NL_CAT_LOCALE);
# endif // MCLoadBySet
if (catalog_fd == (nl_catd) -1)
fprintf(stderr, "failed to open catalog, using default messages\n");
#endif // HAVE_CATOPEN
}
const char* I18n::operator()(int set, int msg, const char *msgString) const {
#if defined(NLS) && defined(HAVE_CATGETS)
if (catalog_fd != (nl_catd) -1)
return catgets(catalog_fd, set, msg, msgString);
else
#endif
return msgString;
}

View file

@ -1,63 +0,0 @@
// -*- mode: C++; indent-tabs-mode: nil; -*-
// i18n.hh for Blackbox - an X11 Window manager
// Copyright (c) 2001 - 2002 Sean 'Shaleh' Perry <shaleh@debian.org>
// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#ifndef __i18n_h
#define __i18n_h
// always include this just for the #defines
// this keeps the calls to i18n->getMessage clean, otherwise we have to
// add ifdefs to every call to getMessage
#include "../nls/blackbox-nls.hh"
extern "C" {
#ifdef HAVE_LOCALE_H
# include <locale.h>
#endif // HAVE_LOCALE_H
#ifdef HAVE_NL_TYPES_H
# include <nl_types.h>
#endif // HAVE_NL_TYPES_H
}
class I18n {
private:
char *locale;
bool mb;
#ifdef HAVE_NL_TYPES_H
nl_catd catalog_fd;
#endif
public:
I18n(void);
~I18n(void);
inline bool multibyte(void) const { return mb; }
const char* operator()(int set, int msg, const char *msgString) const;
void openCatalog(const char *catalog);
};
extern I18n i18n;
#endif // __i18n_h

View file

@ -34,11 +34,10 @@ using std::max;
using std::min;
#include "blackbox.hh"
#include "i18n.hh"
#include "BaseDisplay.hh"
#include "GCCache.hh"
#include "Image.hh"
#include "Texture.hh"
#include "basedisplay.hh"
#include "gccache.hh"
#include "image.hh"
#include "texture.hh"
BImage::BImage(BImageControl *c, int w, int h) {

View file

@ -31,9 +31,9 @@ extern "C" {
#include <list>
#include "Timer.hh"
#include "BaseDisplay.hh"
#include "Color.hh"
#include "timer.hh"
#include "basedisplay.hh"
#include "color.hh"
class BImageControl;
class BTexture;

View file

@ -40,11 +40,10 @@ extern "C" {
#include <algorithm>
#include "blackbox.hh"
#include "i18n.hh"
#include "BaseDisplay.hh"
#include "Color.hh"
#include "Image.hh"
#include "Texture.hh"
#include "basedisplay.hh"
#include "color.hh"
#include "image.hh"
#include "texture.hh"
static unsigned long bsqrt(unsigned long x) {
if (x <= 0) return 0;

View file

@ -52,7 +52,6 @@ extern "C" {
#include <string>
using std::string;
#include "i18n.hh"
#include "blackbox.hh"

View file

@ -77,21 +77,21 @@ using std::string;
#include "i18n.hh"
#include "blackbox.hh"
#include "Clientmenu.hh"
#include "Font.hh"
#include "GCCache.hh"
#include "Iconmenu.hh"
#include "Image.hh"
#include "Screen.hh"
#include "Slit.hh"
#include "Rootmenu.hh"
#include "Toolbar.hh"
#include "Util.hh"
#include "Window.hh"
#include "Workspace.hh"
#include "Workspacemenu.hh"
#include "Util.hh"
#include "XAtom.hh"
#include "clientmenu.hh"
#include "font.hh"
#include "gccache.hh"
#include "iconmenu.hh"
#include "image.hh"
#include "screen.hh"
#include "slit.hh"
#include "rootmenu.hh"
#include "toolbar.hh"
#include "util.hh"
#include "window.hh"
#include "workspace.hh"
#include "workspacemenu.hh"
#include "util.hh"
#include "xatom.hh"
#ifndef FONT_ELEMENT_SIZE
#define FONT_ELEMENT_SIZE 50
@ -2314,8 +2314,7 @@ bool BScreen::parseMenuFile(FILE *file, Rootmenu *menu) {
for (; it != end; ++it) {
const string& fname = *it;
//ignore backups and dot files
if (fname[fname.size()-1] == '~' || fname[0] == '.')
if (fname[fname.size()-1] == '~')
continue;
string style = stylesdir;
@ -2751,13 +2750,11 @@ BFont *BScreen::readDatabaseFont(const string &rbasename,
offset = 1;
}
int tint = 25;
unsigned char tint = 0x40;
if (style.getValue(rbasename + "xft.shadow.tint", s)) {
tint = atoi(s.c_str());
}
if (tint > 100) tint = 100;
if (tint < -100) tint = -100;
BFont *b = new BFont(blackbox->getXDisplay(), this, family, i, bold,
italic, dropShadow && resource.shadow_fonts, offset,

View file

@ -42,16 +42,16 @@ extern "C" {
#include <list>
#include <vector>
#include "Color.hh"
#include "Texture.hh"
#include "Image.hh"
#include "Configmenu.hh"
#include "Iconmenu.hh"
#include "Netizen.hh"
#include "Rootmenu.hh"
#include "Timer.hh"
#include "Workspace.hh"
#include "Workspacemenu.hh"
#include "color.hh"
#include "texture.hh"
#include "image.hh"
#include "configmenu.hh"
#include "iconmenu.hh"
#include "netizen.hh"
#include "rootmenu.hh"
#include "timer.hh"
#include "workspace.hh"
#include "workspacemenu.hh"
#include "blackbox.hh"
class Slit; // forward reference

View file

@ -34,10 +34,10 @@ extern "C" {
#include <assert.h>
#include "Texture.hh"
#include "BaseDisplay.hh"
#include "Image.hh"
#include "Screen.hh"
#include "texture.hh"
#include "basedisplay.hh"
#include "image.hh"
#include "screen.hh"
#include "blackbox.hh"
using std::string;

View file

@ -24,8 +24,8 @@
#ifndef TEXTURE_HH
#define TEXTURE_HH
#include "Color.hh"
#include "Util.hh"
#include "color.hh"
#include "util.hh"
class BImageControl;
#include <string>

View file

@ -25,9 +25,9 @@
# include "../config.h"
#endif // HAVE_CONFIG_H
#include "BaseDisplay.hh"
#include "Timer.hh"
#include "Util.hh"
#include "basedisplay.hh"
#include "timer.hh"
#include "util.hh"
BTimer::BTimer(TimerQueueManager *m, TimeoutHandler *h) {
manager = m;

View file

@ -56,7 +56,7 @@ extern "C" {
#include <algorithm>
#include "Util.hh"
#include "util.hh"
using std::string;

View file

@ -44,20 +44,19 @@ extern "C" {
#endif // HAVE_STDLIB_H
}
#include "i18n.hh"
#include "blackbox.hh"
#include "Clientmenu.hh"
#include "Font.hh"
#include "GCCache.hh"
#include "Iconmenu.hh"
#include "Image.hh"
#include "Screen.hh"
#include "Toolbar.hh"
#include "Util.hh"
#include "Window.hh"
#include "Windowmenu.hh"
#include "Workspace.hh"
#include "Slit.hh"
#include "clientmenu.hh"
#include "font.hh"
#include "gccache.hh"
#include "iconmenu.hh"
#include "image.hh"
#include "screen.hh"
#include "toolbar.hh"
#include "util.hh"
#include "window.hh"
#include "windowmenu.hh"
#include "workspace.hh"
#include "slit.hh"
using std::string;
using std::abs;

View file

@ -34,10 +34,10 @@ extern "C" {
#include <string>
#include "BaseDisplay.hh"
#include "Timer.hh"
#include "Util.hh"
#include "Windowmenu.hh"
#include "basedisplay.hh"
#include "timer.hh"
#include "util.hh"
#include "windowmenu.hh"
#define MwmHintsFunctions (1l << 0)
#define MwmHintsDecorations (1l << 1)

View file

@ -45,18 +45,17 @@ extern "C" {
using std::string;
#include "i18n.hh"
#include "blackbox.hh"
#include "Clientmenu.hh"
#include "Font.hh"
#include "Netizen.hh"
#include "Screen.hh"
#include "Toolbar.hh"
#include "Util.hh"
#include "Window.hh"
#include "Workspace.hh"
#include "Windowmenu.hh"
#include "XAtom.hh"
#include "clientmenu.hh"
#include "font.hh"
#include "netizen.hh"
#include "screen.hh"
#include "toolbar.hh"
#include "util.hh"
#include "window.hh"
#include "workspace.hh"
#include "windowmenu.hh"
#include "xatom.hh"
Workspace::Workspace(BScreen *scrn, unsigned int i) {

View file

@ -23,9 +23,9 @@
#include <assert.h>
#include "XAtom.hh"
#include "Screen.hh"
#include "Util.hh"
#include "xatom.hh"
#include "screen.hh"
#include "util.hh"
XAtom::XAtom(Display *d) {
_display = d;