Using some references instead of pointers for the menus.

This commit is contained in:
Dana Jansens 2002-04-14 11:37:22 +00:00
parent d00ef14582
commit 351f1d0331
25 changed files with 290 additions and 313 deletions

View file

@ -49,11 +49,9 @@ using namespace std;
static Basemenu *shown = (Basemenu *) 0;
Basemenu::Basemenu(BScreen *scrn) {
screen = scrn;
openbox = screen->getOpenbox();
image_ctrl = screen->getImageControl();
display = openbox->getXDisplay();
Basemenu::Basemenu(BScreen &scrn) : screen(scrn), openbox(*scrn.getOpenbox()) {
image_ctrl = screen.getImageControl();
display = openbox.getXDisplay();
parent = (Basemenu *) 0;
alignment = AlignDontCare;
@ -83,16 +81,16 @@ Basemenu::Basemenu(BScreen *scrn) {
menu.hilite_pixmap =
menu.sel_pixmap = None;
menu.bevel_w = screen->getBevelWidth();
menu.bevel_w = screen.getBevelWidth();
if (i18n->multibyte())
menu.width = menu.title_h = menu.item_w = menu.frame_h =
screen->getMenuStyle()->t_fontset_extents->max_ink_extent.height +
screen.getMenuStyle()->t_fontset_extents->max_ink_extent.height +
(menu.bevel_w * 2);
else
menu.width = menu.title_h = menu.item_w = menu.frame_h =
screen->getMenuStyle()->t_font->ascent +
screen->getMenuStyle()->t_font->descent + (menu.bevel_w * 2);
screen.getMenuStyle()->t_font->ascent +
screen.getMenuStyle()->t_font->descent + (menu.bevel_w * 2);
menu.label = 0;
@ -100,7 +98,7 @@ Basemenu::Basemenu(BScreen *scrn) {
menu.persub =
menu.minsub = 0;
MenuStyle *style = screen->getMenuStyle();
MenuStyle *style = screen.getMenuStyle();
if (i18n->multibyte()) {
menu.item_h = style->f_fontset_extents->max_ink_extent.height +
(menu.bevel_w);
@ -109,42 +107,42 @@ Basemenu::Basemenu(BScreen *scrn) {
(menu.bevel_w);
}
menu.height = menu.title_h + screen->getBorderWidth() + menu.frame_h;
menu.height = menu.title_h + screen.getBorderWidth() + menu.frame_h;
unsigned long attrib_mask = CWBackPixmap | CWBackPixel | CWBorderPixel |
CWColormap | CWOverrideRedirect | CWEventMask;
XSetWindowAttributes attrib;
attrib.background_pixmap = None;
attrib.background_pixel = attrib.border_pixel =
screen->getBorderColor()->getPixel();
attrib.colormap = screen->getColormap();
screen.getBorderColor()->getPixel();
attrib.colormap = screen.getColormap();
attrib.override_redirect = True;
attrib.event_mask = ButtonPressMask | ButtonReleaseMask |
ButtonMotionMask | ExposureMask;
menu.window =
XCreateWindow(display, screen->getRootWindow(), menu.x, menu.y, menu.width,
menu.height, screen->getBorderWidth(), screen->getDepth(),
InputOutput, screen->getVisual(), attrib_mask, &attrib);
openbox->saveMenuSearch(menu.window, this);
XCreateWindow(display, screen.getRootWindow(), menu.x, menu.y, menu.width,
menu.height, screen.getBorderWidth(), screen.getDepth(),
InputOutput, screen.getVisual(), attrib_mask, &attrib);
openbox.saveMenuSearch(menu.window, this);
attrib_mask = CWBackPixmap | CWBackPixel | CWBorderPixel | CWEventMask;
attrib.background_pixel = screen->getBorderColor()->getPixel();
attrib.background_pixel = screen.getBorderColor()->getPixel();
attrib.event_mask |= EnterWindowMask | LeaveWindowMask;
menu.title =
XCreateWindow(display, menu.window, 0, 0, menu.width, menu.height, 0,
screen->getDepth(), InputOutput, screen->getVisual(),
screen.getDepth(), InputOutput, screen.getVisual(),
attrib_mask, &attrib);
openbox->saveMenuSearch(menu.title, this);
openbox.saveMenuSearch(menu.title, this);
attrib.event_mask |= PointerMotionMask;
menu.frame = XCreateWindow(display, menu.window, 0,
menu.title_h + screen->getBorderWidth(),
menu.title_h + screen.getBorderWidth(),
menu.width, menu.frame_h, 0,
screen->getDepth(), InputOutput,
screen->getVisual(), attrib_mask, &attrib);
openbox->saveMenuSearch(menu.frame, this);
screen.getDepth(), InputOutput,
screen.getVisual(), attrib_mask, &attrib);
openbox.saveMenuSearch(menu.frame, this);
menuitems = new LinkedList<BasemenuItem>;
@ -180,13 +178,13 @@ Basemenu::~Basemenu(void) {
if (menu.sel_pixmap)
image_ctrl->removeImage(menu.sel_pixmap);
openbox->removeMenuSearch(menu.title);
openbox.removeMenuSearch(menu.title);
XDestroyWindow(display, menu.title);
openbox->removeMenuSearch(menu.frame);
openbox.removeMenuSearch(menu.frame);
XDestroyWindow(display, menu.frame);
openbox->removeMenuSearch(menu.window);
openbox.removeMenuSearch(menu.window);
XDestroyWindow(display, menu.window);
}
@ -261,7 +259,7 @@ int Basemenu::remove(int index) {
void Basemenu::update(void) {
MenuStyle *style = screen->getMenuStyle();
MenuStyle *style = screen.getMenuStyle();
if (i18n->multibyte()) {
menu.item_h = style->f_fontset_extents->max_ink_extent.height +
menu.bevel_w;
@ -283,10 +281,10 @@ void Basemenu::update(void) {
if (i18n->multibyte()) {
XRectangle ink, logical;
XmbTextExtents(screen->getMenuStyle()->t_fontset, s, l, &ink, &logical);
XmbTextExtents(screen.getMenuStyle()->t_fontset, s, l, &ink, &logical);
menu.item_w = logical.width;
} else {
menu.item_w = XTextWidth(screen->getMenuStyle()->t_font, s, l);
menu.item_w = XTextWidth(screen.getMenuStyle()->t_font, s, l);
}
menu.item_w += (menu.bevel_w * 2);
@ -303,10 +301,10 @@ void Basemenu::update(void) {
if (i18n->multibyte()) {
XRectangle ink, logical;
XmbTextExtents(screen->getMenuStyle()->f_fontset, s, l, &ink, &logical);
XmbTextExtents(screen.getMenuStyle()->f_fontset, s, l, &ink, &logical);
ii = logical.width;
} else
ii = XTextWidth(screen->getMenuStyle()->f_font, s, l);
ii = XTextWidth(screen.getMenuStyle()->f_font, s, l);
ii += (menu.bevel_w * 2) + (menu.item_h * 2);
@ -317,8 +315,8 @@ void Basemenu::update(void) {
menu.sublevels = 1;
while (((menu.item_h * (menuitems->count() + 1) / menu.sublevels)
+ menu.title_h + screen->getBorderWidth()) >
screen->getHeight())
+ menu.title_h + screen.getBorderWidth()) >
screen.getHeight())
menu.sublevels++;
if (menu.sublevels < menu.minsub) menu.sublevels = menu.minsub;
@ -334,7 +332,7 @@ void Basemenu::update(void) {
if (! menu.width) menu.width = menu.item_w;
menu.frame_h = (menu.item_h * menu.persub);
menu.height = ((title_vis) ? menu.title_h + screen->getBorderWidth() : 0) +
menu.height = ((title_vis) ? menu.title_h + screen.getBorderWidth() : 0) +
menu.frame_h;
if (! menu.frame_h) menu.frame_h = 1;
if (menu.height < 1) menu.height = 1;
@ -343,7 +341,7 @@ void Basemenu::update(void) {
BTexture *texture;
if (title_vis) {
tmp = menu.title_pixmap;
texture = &(screen->getMenuStyle()->title);
texture = &(screen.getMenuStyle()->title);
if (texture->getTexture() == (BImage_Flat | BImage_Solid)) {
menu.title_pixmap = None;
XSetWindowBackground(display, menu.title,
@ -358,7 +356,7 @@ void Basemenu::update(void) {
}
tmp = menu.frame_pixmap;
texture = &(screen->getMenuStyle()->frame);
texture = &(screen.getMenuStyle()->frame);
if (texture->getTexture() == (BImage_Flat | BImage_Solid)) {
menu.frame_pixmap = None;
XSetWindowBackground(display, menu.frame,
@ -371,7 +369,7 @@ void Basemenu::update(void) {
if (tmp) image_ctrl->removeImage(tmp);
tmp = menu.hilite_pixmap;
texture = &(screen->getMenuStyle()->hilite);
texture = &(screen.getMenuStyle()->hilite);
if (texture->getTexture() == (BImage_Flat | BImage_Solid)) {
menu.hilite_pixmap = None;
} else {
@ -397,7 +395,7 @@ void Basemenu::update(void) {
XMoveResizeWindow(display, menu.frame, 0,
((title_vis) ? menu.title_h +
screen->getBorderWidth() : 0), menu.width,
screen.getBorderWidth() : 0), menu.width,
menu.frame_h);
XClearWindow(display, menu.window);
@ -487,15 +485,15 @@ void Basemenu::redrawTitle(void) {
if (i18n->multibyte()) {
XRectangle ink, logical;
XmbTextExtents(screen->getMenuStyle()->t_fontset, text, len, &ink, &logical);
XmbTextExtents(screen.getMenuStyle()->t_fontset, text, len, &ink, &logical);
l = logical.width;
} else {
l = XTextWidth(screen->getMenuStyle()->t_font, text, len);
l = XTextWidth(screen.getMenuStyle()->t_font, text, len);
}
l += (menu.bevel_w * 2);
switch (screen->getMenuStyle()->t_justify) {
switch (screen.getMenuStyle()->t_justify) {
case BScreen::RightJustify:
dx += menu.width - l;
break;
@ -505,7 +503,7 @@ void Basemenu::redrawTitle(void) {
break;
}
MenuStyle *style = screen->getMenuStyle();
MenuStyle *style = screen.getMenuStyle();
if (i18n->multibyte())
XmbDrawString(display, menu.title, style->t_fontset, style->t_text_gc, dx,
(menu.bevel_w - style->t_fontset_extents->max_ink_extent.y),
@ -531,19 +529,19 @@ void Basemenu::drawSubmenu(int index) {
if (item->submenu()->parent != this) item->submenu()->parent = this;
int sbl = index / menu.persub, i = index - (sbl * menu.persub),
x = menu.x +
((menu.item_w * (sbl + 1)) + screen->getBorderWidth()), y;
((menu.item_w * (sbl + 1)) + screen.getBorderWidth()), y;
if (alignment == AlignTop)
y = (((shifted) ? menu.y_shift : menu.y) +
((title_vis) ? menu.title_h + screen->getBorderWidth() : 0) -
((title_vis) ? menu.title_h + screen.getBorderWidth() : 0) -
((item->submenu()->title_vis) ?
item->submenu()->menu.title_h + screen->getBorderWidth() : 0));
item->submenu()->menu.title_h + screen.getBorderWidth() : 0));
else
y = (((shifted) ? menu.y_shift : menu.y) +
(menu.item_h * i) +
((title_vis) ? menu.title_h + screen->getBorderWidth() : 0) -
((title_vis) ? menu.title_h + screen.getBorderWidth() : 0) -
((item->submenu()->title_vis) ?
item->submenu()->menu.title_h + screen->getBorderWidth() : 0));
item->submenu()->menu.title_h + screen.getBorderWidth() : 0));
if (alignment == AlignBottom &&
(y + item->submenu()->menu.height) > ((shifted) ? menu.y_shift :
@ -551,16 +549,16 @@ void Basemenu::drawSubmenu(int index) {
y = (((shifted) ? menu.y_shift : menu.y) +
menu.height - item->submenu()->menu.height);
if ((x + item->submenu()->getWidth()) > screen->getWidth()) {
if ((x + item->submenu()->getWidth()) > screen.getWidth()) {
x = ((shifted) ? menu.x_shift : menu.x) -
item->submenu()->getWidth() - screen->getBorderWidth();
item->submenu()->getWidth() - screen.getBorderWidth();
}
if (x < 0) x = 0;
if ((y + item->submenu()->getHeight()) > screen->getHeight())
y = screen->getHeight() - item->submenu()->getHeight() -
(screen->getBorderWidth() * 2);
if ((y + item->submenu()->getHeight()) > screen.getHeight())
y = screen.getHeight() - item->submenu()->getHeight() -
(screen.getBorderWidth() * 2);
if (y < 0) y = 0;
item->submenu()->move(x, y);
@ -607,19 +605,19 @@ void Basemenu::drawItem(int index, Bool highlight, Bool clear,
if (text) {
if (i18n->multibyte()) {
XRectangle ink, logical;
XmbTextExtents(screen->getMenuStyle()->f_fontset,
XmbTextExtents(screen.getMenuStyle()->f_fontset,
text, len, &ink, &logical);
text_w = logical.width;
text_y = item_y + (menu.bevel_w / 2) -
screen->getMenuStyle()->f_fontset_extents->max_ink_extent.y;
screen.getMenuStyle()->f_fontset_extents->max_ink_extent.y;
} else {
text_w = XTextWidth(screen->getMenuStyle()->f_font, text, len);
text_w = XTextWidth(screen.getMenuStyle()->f_font, text, len);
text_y = item_y +
screen->getMenuStyle()->f_font->ascent +
screen.getMenuStyle()->f_font->ascent +
(menu.bevel_w / 2);
}
switch(screen->getMenuStyle()->f_justify) {
switch(screen.getMenuStyle()->f_justify) {
case BScreen::LeftJustify:
text_x = item_x + menu.bevel_w + menu.item_h + 1;
break;
@ -637,15 +635,15 @@ void Basemenu::drawItem(int index, Bool highlight, Bool clear,
}
GC gc =
((highlight || item->isSelected()) ? screen->getMenuStyle()->h_text_gc :
screen->getMenuStyle()->f_text_gc),
((highlight || item->isSelected()) ? screen.getMenuStyle()->h_text_gc :
screen.getMenuStyle()->f_text_gc),
tgc =
((highlight) ? screen->getMenuStyle()->h_text_gc :
((item->isEnabled()) ? screen->getMenuStyle()->f_text_gc :
screen->getMenuStyle()->d_text_gc));
((highlight) ? screen.getMenuStyle()->h_text_gc :
((item->isEnabled()) ? screen.getMenuStyle()->f_text_gc :
screen.getMenuStyle()->d_text_gc));
sel_x = item_x;
if (screen->getMenuStyle()->bullet_pos == Right)
if (screen.getMenuStyle()->bullet_pos == Right)
sel_x += (menu.item_w - menu.item_h - menu.bevel_w);
sel_x += quarter_w;
sel_y = item_y + quarter_w;
@ -682,34 +680,34 @@ void Basemenu::drawItem(int index, Bool highlight, Bool clear,
if (dohilite && highlight && (menu.hilite_pixmap != ParentRelative)) {
if (menu.hilite_pixmap)
XCopyArea(display, menu.hilite_pixmap, menu.frame,
screen->getMenuStyle()->hilite_gc, hoff_x, hoff_y,
screen.getMenuStyle()->hilite_gc, hoff_x, hoff_y,
hilite_w, hilite_h, hilite_x, hilite_y);
else
XFillRectangle(display, menu.frame,
screen->getMenuStyle()->hilite_gc,
screen.getMenuStyle()->hilite_gc,
hilite_x, hilite_y, hilite_w, hilite_h);
} else if (dosel && item->isSelected() &&
(menu.sel_pixmap != ParentRelative)) {
if (menu.sel_pixmap)
XCopyArea(display, menu.sel_pixmap, menu.frame,
screen->getMenuStyle()->hilite_gc, 0, 0,
screen.getMenuStyle()->hilite_gc, 0, 0,
half_w, half_w, sel_x, sel_y);
else
XFillRectangle(display, menu.frame,
screen->getMenuStyle()->hilite_gc,
screen.getMenuStyle()->hilite_gc,
sel_x, sel_y, half_w, half_w);
}
if (dotext && text) {
if (i18n->multibyte())
XmbDrawString(display, menu.frame, screen->getMenuStyle()->f_fontset,
XmbDrawString(display, menu.frame, screen.getMenuStyle()->f_fontset,
tgc, text_x, text_y, text, len);
else
XDrawString(display, menu.frame, tgc, text_x, text_y, text, len);
}
if (dosel && item->submenu()) {
switch (screen->getMenuStyle()->bullet) {
switch (screen.getMenuStyle()->bullet) {
case Square:
XDrawRectangle(display, menu.frame, gc, sel_x, sel_y, half_w, half_w);
break;
@ -717,7 +715,7 @@ void Basemenu::drawItem(int index, Bool highlight, Bool clear,
case Triangle:
XPoint tri[3];
if (screen->getMenuStyle()->bullet_pos == Right) {
if (screen.getMenuStyle()->bullet_pos == Right) {
tri[0].x = sel_x + quarter_w - 2;
tri[0].y = sel_y + quarter_w - 2;
tri[1].x = 4;
@ -965,21 +963,21 @@ void Basemenu::exposeEvent(XExposeEvent *ee) {
void Basemenu::enterNotifyEvent(XCrossingEvent *ce) {
if (ce->window == menu.frame) {
menu.x_shift = menu.x, menu.y_shift = menu.y;
if (menu.x + menu.width > screen->getWidth()) {
menu.x_shift = screen->getWidth() - menu.width -
screen->getBorderWidth();
if (menu.x + menu.width > screen.getWidth()) {
menu.x_shift = screen.getWidth() - menu.width -
screen.getBorderWidth();
shifted = True;
} else if (menu.x < 0) {
menu.x_shift = -screen->getBorderWidth();
menu.x_shift = -screen.getBorderWidth();
shifted = True;
}
if (menu.y + menu.height > screen->getHeight()) {
menu.y_shift = screen->getHeight() - menu.height -
screen->getBorderWidth();
if (menu.y + menu.height > screen.getHeight()) {
menu.y_shift = screen.getHeight() - menu.height -
screen.getBorderWidth();
shifted = True;
} else if (menu.y + (signed) menu.title_h < 0) {
menu.y_shift = -screen->getBorderWidth();
menu.y_shift = -screen.getBorderWidth();
shifted = True;
}
@ -1026,11 +1024,11 @@ void Basemenu::leaveNotifyEvent(XCrossingEvent *ce) {
void Basemenu::reconfigure(void) {
XSetWindowBackground(display, menu.window,
screen->getBorderColor()->getPixel());
screen.getBorderColor()->getPixel());
XSetWindowBorder(display, menu.window,
screen->getBorderColor()->getPixel());
XSetWindowBorderWidth(display, menu.window, screen->getBorderWidth());
screen.getBorderColor()->getPixel());
XSetWindowBorderWidth(display, menu.window, screen.getBorderWidth());
menu.bevel_w = screen->getBevelWidth();
menu.bevel_w = screen.getBevelWidth();
update();
}

View file

@ -36,10 +36,10 @@ class BasemenuItem;
class Basemenu {
private:
LinkedList<BasemenuItem> *menuitems;
Openbox *openbox;
Openbox &openbox;
Basemenu *parent;
BImageControl *image_ctrl;
BScreen *screen;
BScreen &screen;
Bool moving, visible, movable, torn, internal_menu, title_vis, shifted,
hide_tree;
@ -74,13 +74,13 @@ protected:
public:
Basemenu(BScreen *);
Basemenu(BScreen &);
virtual ~Basemenu(void);
inline const Bool &isTorn(void) const { return torn; }
inline const Bool &isVisible(void) const { return visible; }
inline BScreen *getScreen(void) { return screen; }
inline BScreen &getScreen(void) { return screen; }
inline const Window &getWindowID(void) const { return menu.window; }

View file

@ -38,10 +38,9 @@
#include "Workspacemenu.h"
Clientmenu::Clientmenu(Workspace *ws) : Basemenu(ws->getScreen()) {
wkspc = ws;
screen = wkspc->getScreen();
Clientmenu::Clientmenu(Workspace &ws) : Basemenu(*ws.getScreen()),
screen(*ws.getScreen()), wkspc(ws)
{
setInternalMenu();
}
@ -49,16 +48,16 @@ Clientmenu::Clientmenu(Workspace *ws) : Basemenu(ws->getScreen()) {
void Clientmenu::itemSelected(int button, int index) {
if (button > 2) return;
OpenboxWindow *win = wkspc->getWindow(index);
OpenboxWindow *win = wkspc.getWindow(index);
if (win) {
if (button == 1) {
if (! wkspc->isCurrent()) wkspc->setCurrent();
if (! wkspc.isCurrent()) wkspc.setCurrent();
} else if (button == 2) {
if (! wkspc->isCurrent()) win->deiconify(True, False);
if (! wkspc.isCurrent()) win->deiconify(True, False);
}
wkspc->raiseWindow(win);
wkspc.raiseWindow(win);
win->setInputFocus();
}
if (! (screen->getWorkspacemenu()->isTorn() || isTorn())) hide();
if (! (screen.getWorkspacemenu()->isTorn() || isTorn())) hide();
}

View file

@ -29,14 +29,14 @@ class BScreen;
class Clientmenu : public Basemenu {
private:
BScreen *screen;
Workspace *wkspc;
BScreen &screen;
Workspace &wkspc;
protected:
virtual void itemSelected(int, int);
public:
Clientmenu(Workspace *);
Clientmenu(Workspace &);
};

View file

@ -36,9 +36,8 @@
#include "Window.h"
#include "Screen.h"
Configmenu::Configmenu(BScreen *scr) : Basemenu(scr) {
screen = scr;
openbox = screen->getOpenbox();
Configmenu::Configmenu(BScreen &scr) : Basemenu(scr), screen(scr)
{
setLabel(i18n->getMessage(ConfigmenuSet, ConfigmenuConfigOptions,
"Config options"));
setInternalMenu();
@ -62,11 +61,11 @@ Configmenu::Configmenu(BScreen *scr) : Basemenu(scr) {
"Focus Last Window on Workspace"), 5);
update();
setItemSelected(2, screen->getImageControl()->doDither());
setItemSelected(3, screen->doOpaqueMove());
setItemSelected(4, screen->doFullMax());
setItemSelected(5, screen->doFocusNew());
setItemSelected(6, screen->doFocusLast());
setItemSelected(2, screen.getImageControl()->doDither());
setItemSelected(3, screen.doOpaqueMove());
setItemSelected(4, screen.doFullMax());
setItemSelected(5, screen.doFocusNew());
setItemSelected(6, screen.doFocusLast());
}
Configmenu::~Configmenu(void) {
@ -85,39 +84,39 @@ void Configmenu::itemSelected(int button, int index) {
switch(item->function()) {
case 1: { // dither
screen->getImageControl()->
setDither((! screen->getImageControl()->doDither()));
screen.getImageControl()->
setDither((! screen.getImageControl()->doDither()));
setItemSelected(index, screen->getImageControl()->doDither());
setItemSelected(index, screen.getImageControl()->doDither());
break;
}
case 2: { // opaque move
screen->saveOpaqueMove((! screen->doOpaqueMove()));
screen.saveOpaqueMove((! screen.doOpaqueMove()));
setItemSelected(index, screen->doOpaqueMove());
setItemSelected(index, screen.doOpaqueMove());
break;
}
case 3: { // full maximization
screen->saveFullMax((! screen->doFullMax()));
screen.saveFullMax((! screen.doFullMax()));
setItemSelected(index, screen->doFullMax());
setItemSelected(index, screen.doFullMax());
break;
}
case 4: { // focus new windows
screen->saveFocusNew((! screen->doFocusNew()));
screen.saveFocusNew((! screen.doFocusNew()));
setItemSelected(index, screen->doFocusNew());
setItemSelected(index, screen.doFocusNew());
break;
}
case 5: { // focus last window on workspace
screen->saveFocusLast((! screen->doFocusLast()));
setItemSelected(index, screen->doFocusLast());
screen.saveFocusLast((! screen.doFocusLast()));
setItemSelected(index, screen.doFocusLast());
break;
}
} // switch
@ -145,10 +144,10 @@ Configmenu::Focusmenu::Focusmenu(Configmenu *cm) : Basemenu(cm->screen) {
"Auto Raise"), 3);
update();
setItemSelected(0, (! configmenu->screen->isSloppyFocus()));
setItemSelected(1, configmenu->screen->isSloppyFocus());
setItemEnabled(2, configmenu->screen->isSloppyFocus());
setItemSelected(2, configmenu->screen->doAutoRaise());
setItemSelected(0, (! configmenu->screen.isSloppyFocus()));
setItemSelected(1, configmenu->screen.isSloppyFocus());
setItemEnabled(2, configmenu->screen.isSloppyFocus());
setItemSelected(2, configmenu->screen.doAutoRaise());
}
void Configmenu::Focusmenu::itemSelected(int button, int index) {
@ -162,41 +161,41 @@ void Configmenu::Focusmenu::itemSelected(int button, int index) {
switch (item->function()) {
case 1: // click to focus
configmenu->screen->saveSloppyFocus(False);
configmenu->screen->saveAutoRaise(False);
configmenu->screen.saveSloppyFocus(False);
configmenu->screen.saveAutoRaise(False);
if (! configmenu->screen->getOpenbox()->getFocusedWindow())
XSetInputFocus(configmenu->screen->getOpenbox()->getXDisplay(),
configmenu->screen->getToolbar()->getWindowID(),
if (! configmenu->screen.getOpenbox()->getFocusedWindow())
XSetInputFocus(configmenu->screen.getOpenbox()->getXDisplay(),
configmenu->screen.getToolbar()->getWindowID(),
RevertToParent, CurrentTime);
else
XSetInputFocus(configmenu->screen->getOpenbox()->getXDisplay(),
configmenu->screen->getOpenbox()->
XSetInputFocus(configmenu->screen.getOpenbox()->getXDisplay(),
configmenu->screen.getOpenbox()->
getFocusedWindow()->getClientWindow(),
RevertToParent, CurrentTime);
configmenu->screen->reconfigure();
configmenu->screen.reconfigure();
break;
case 2: // sloppy focus
configmenu->screen->saveSloppyFocus(True);
configmenu->screen.saveSloppyFocus(True);
configmenu->screen->reconfigure();
configmenu->screen.reconfigure();
break;
case 3: // auto raise with sloppy focus
Bool change = ((configmenu->screen->doAutoRaise()) ? False : True);
configmenu->screen->saveAutoRaise(change);
Bool change = ((configmenu->screen.doAutoRaise()) ? False : True);
configmenu->screen.saveAutoRaise(change);
break;
}
setItemSelected(0, (! configmenu->screen->isSloppyFocus()));
setItemSelected(1, configmenu->screen->isSloppyFocus());
setItemEnabled(2, configmenu->screen->isSloppyFocus());
setItemSelected(2, configmenu->screen->doAutoRaise());
setItemSelected(0, (! configmenu->screen.isSloppyFocus()));
setItemSelected(1, configmenu->screen.isSloppyFocus());
setItemEnabled(2, configmenu->screen.isSloppyFocus());
setItemSelected(2, configmenu->screen.doAutoRaise());
}
Configmenu::Placementmenu::Placementmenu(Configmenu *cm) :
@ -227,7 +226,7 @@ Configmenu::Placementmenu::Placementmenu(Configmenu *cm) :
"Bottom to Top"), BScreen::BottomTop);
update();
switch (configmenu->screen->getPlacementPolicy()) {
switch (configmenu->screen.getPlacementPolicy()) {
case BScreen::RowSmartPlacement:
setItemSelected(0, True);
break;
@ -245,9 +244,9 @@ Configmenu::Placementmenu::Placementmenu(Configmenu *cm) :
break;
}
Bool rl = (configmenu->screen->getRowPlacementDirection() ==
Bool rl = (configmenu->screen.getRowPlacementDirection() ==
BScreen::LeftRight),
tb = (configmenu->screen->getColPlacementDirection() ==
tb = (configmenu->screen.getColPlacementDirection() ==
BScreen::TopBottom);
setItemSelected(4, rl);
@ -268,7 +267,7 @@ void Configmenu::Placementmenu::itemSelected(int button, int index) {
switch (item->function()) {
case BScreen::RowSmartPlacement:
configmenu->screen->savePlacementPolicy(item->function());
configmenu->screen.savePlacementPolicy(item->function());
setItemSelected(0, True);
setItemSelected(1, False);
@ -278,7 +277,7 @@ void Configmenu::Placementmenu::itemSelected(int button, int index) {
break;
case BScreen::ColSmartPlacement:
configmenu->screen->savePlacementPolicy(item->function());
configmenu->screen.savePlacementPolicy(item->function());
setItemSelected(0, False);
setItemSelected(1, True);
@ -288,7 +287,7 @@ void Configmenu::Placementmenu::itemSelected(int button, int index) {
break;
case BScreen::CascadePlacement:
configmenu->screen->savePlacementPolicy(item->function());
configmenu->screen.savePlacementPolicy(item->function());
setItemSelected(0, False);
setItemSelected(1, False);
@ -298,7 +297,7 @@ void Configmenu::Placementmenu::itemSelected(int button, int index) {
break;
case BScreen::BestFitPlacement:
configmenu->screen->savePlacementPolicy(item->function());
configmenu->screen.savePlacementPolicy(item->function());
setItemSelected(0, False);
setItemSelected(1, False);
@ -308,7 +307,7 @@ void Configmenu::Placementmenu::itemSelected(int button, int index) {
break;
case BScreen::LeftRight:
configmenu->screen->saveRowPlacementDirection(BScreen::LeftRight);
configmenu->screen.saveRowPlacementDirection(BScreen::LeftRight);
setItemSelected(4, True);
setItemSelected(5, False);
@ -316,7 +315,7 @@ void Configmenu::Placementmenu::itemSelected(int button, int index) {
break;
case BScreen::RightLeft:
configmenu->screen->saveRowPlacementDirection(BScreen::RightLeft);
configmenu->screen.saveRowPlacementDirection(BScreen::RightLeft);
setItemSelected(4, False);
setItemSelected(5, True);
@ -324,7 +323,7 @@ void Configmenu::Placementmenu::itemSelected(int button, int index) {
break;
case BScreen::TopBottom:
configmenu->screen->saveColPlacementDirection(BScreen::TopBottom);
configmenu->screen.saveColPlacementDirection(BScreen::TopBottom);
setItemSelected(5, True);
setItemSelected(6, False);
@ -332,7 +331,7 @@ void Configmenu::Placementmenu::itemSelected(int button, int index) {
break;
case BScreen::BottomTop:
configmenu->screen->saveColPlacementDirection(BScreen::BottomTop);
configmenu->screen.saveColPlacementDirection(BScreen::BottomTop);
setItemSelected(5, False);
setItemSelected(6, True);

View file

@ -54,8 +54,7 @@ private:
Placementmenu(Configmenu *);
};
Openbox *openbox;
BScreen *screen;
BScreen &screen;
Focusmenu *focusmenu;
Placementmenu *placementmenu;
@ -66,7 +65,7 @@ protected:
virtual void itemSelected(int, int);
public:
Configmenu(BScreen *);
Configmenu(BScreen &);
virtual ~Configmenu(void);
inline Basemenu *getFocusmenu(void) { return focusmenu; }

View file

@ -36,11 +36,9 @@
#include "Window.h"
Iconmenu::Iconmenu(BScreen *scrn) : Basemenu(scrn) {
Iconmenu::Iconmenu(BScreen &scrn) : Basemenu(scrn), screen(scrn) {
setInternalMenu();
screen = scrn;
setLabel(i18n->getMessage(IconSet, IconIcons, "Icons"));
update();
}
@ -50,8 +48,8 @@ void Iconmenu::itemSelected(int button, int index) {
if (button != 1)
return;
if (index >= 0 && index < screen->getIconCount()) {
OpenboxWindow *win = screen->getIcon(index);
if (index >= 0 && index < screen.getIconCount()) {
OpenboxWindow *win = screen.getIcon(index);
if (win) {
win->deiconify();
@ -59,6 +57,6 @@ void Iconmenu::itemSelected(int button, int index) {
}
}
if (! (screen->getWorkspacemenu()->isTorn() || isTorn()))
if (! (screen.getWorkspacemenu()->isTorn() || isTorn()))
hide();
}

View file

@ -31,13 +31,13 @@ class BScreen;
class Iconmenu : public Basemenu {
private:
BScreen *screen;
BScreen &screen;
protected:
virtual void itemSelected(int, int);
public:
Iconmenu(BScreen *);
Iconmenu(BScreen &);
};

View file

@ -1774,7 +1774,7 @@ BImageControl::BImageControl(BaseDisplay *dpy, ScreenInfo *scrn, Bool _dither,
cache_max = cmax;
#ifdef TIMEDCACHE
if (cache_timeout) {
timer = new BTimer(basedisplay, this);
timer = new BTimer(*basedisplay, *this);
timer->setTimeout(cache_timeout);
timer->start();
} else

View file

@ -52,9 +52,9 @@
#endif // MAXPATHLEN
Rootmenu::Rootmenu(BScreen *scrn) : Basemenu(scrn) {
screen = scrn;
openbox = screen->getOpenbox();
Rootmenu::Rootmenu(BScreen &scrn) : Basemenu(scrn), screen(scrn),
openbox(*scrn.getOpenbox())
{
}
@ -73,9 +73,9 @@ void Rootmenu::itemSelected(int button, int index) {
#ifndef __EMX__
char displaystring[MAXPATHLEN];
sprintf(displaystring, "DISPLAY=%s",
DisplayString(screen->getBaseDisplay()->getXDisplay()));
DisplayString(screen.getBaseDisplay()->getXDisplay()));
sprintf(displaystring + strlen(displaystring) - 1, "%d",
screen->getScreenNumber());
screen.getScreenNumber());
bexec(item->exec(), displaystring);
#else // __EMX__
@ -85,28 +85,28 @@ void Rootmenu::itemSelected(int button, int index) {
break;
case BScreen::Restart:
openbox->restart();
openbox.restart();
break;
case BScreen::RestartOther:
if (item->exec())
openbox->restart(item->exec());
openbox.restart(item->exec());
break;
case BScreen::Exit:
openbox->shutdown();
openbox.shutdown();
break;
case BScreen::SetStyle:
if (item->exec())
openbox->saveStyleFilename(item->exec());
openbox.saveStyleFilename(item->exec());
case BScreen::Reconfigure:
openbox->reconfigure();
openbox.reconfigure();
return;
}
if (! (screen->getRootmenu()->isTorn() || isTorn()) &&
if (! (screen.getRootmenu()->isTorn() || isTorn()) &&
item->function() != BScreen::Reconfigure &&
item->function() != BScreen::SetStyle)
hide();

View file

@ -34,8 +34,8 @@ class BScreen;
class Rootmenu : public Basemenu {
private:
Openbox *openbox;
BScreen *screen;
Openbox &openbox;
BScreen &screen;
protected:
@ -43,7 +43,7 @@ protected:
public:
Rootmenu(BScreen *);
Rootmenu(BScreen &);
};

View file

@ -180,8 +180,8 @@ static const char *getFontSize(const char *pattern, int *size) {
}
BScreen::BScreen(Openbox *bb, int scrn) : ScreenInfo(bb, scrn) {
openbox = bb;
BScreen::BScreen(Openbox *ob, int scrn) : ScreenInfo(ob, scrn) {
openbox = ob;
event_mask = ColormapChangeMask | EnterWindowMask | PropertyChangeMask |
SubstructureRedirectMask | KeyPressMask | KeyReleaseMask |
@ -389,9 +389,9 @@ BScreen::BScreen(Openbox *bb, int scrn) : ScreenInfo(bb, scrn) {
}
}
workspacemenu = new Workspacemenu(this);
iconmenu = new Iconmenu(this);
configmenu = new Configmenu(this);
workspacemenu = new Workspacemenu(*this);
iconmenu = new Iconmenu(*this);
configmenu = new Configmenu(*this);
Workspace *wkspc = (Workspace *) 0;
if (resource.workspaces != 0) {
@ -1696,7 +1696,7 @@ void BScreen::InitMenu(void) {
while (rootmenu->getCount())
rootmenu->remove(0);
} else {
rootmenu = new Rootmenu(this);
rootmenu = new Rootmenu(*this);
}
Bool defaultMenu = True;
@ -1984,7 +1984,7 @@ Bool BScreen::parseMenuFile(FILE *file, Rootmenu *menu) {
continue;
}
Rootmenu *submenu = new Rootmenu(this);
Rootmenu *submenu = new Rootmenu(*this);
if (*command)
submenu->setLabel(command);
@ -2075,7 +2075,7 @@ Bool BScreen::parseMenuFile(FILE *file, Rootmenu *menu) {
Rootmenu *stylesmenu;
if (newmenu)
stylesmenu = new Rootmenu(this);
stylesmenu = new Rootmenu(*this);
else
stylesmenu = menu;

View file

@ -52,13 +52,13 @@ Slit::Slit(BScreen *scr) {
display = screen->getBaseDisplay()->getXDisplay();
frame.window = frame.pixmap = None;
timer = new BTimer(openbox, this);
timer = new BTimer(*openbox, *this);
timer->setTimeout(openbox->getAutoRaiseDelay());
timer->fireOnce(True);
clientList = new LinkedList<SlitClient>;
slitmenu = new Slitmenu(this);
slitmenu = new Slitmenu(*this);
XSetWindowAttributes attrib;
unsigned long create_mask = CWBackPixmap | CWBackPixel | CWBorderPixel |
@ -609,14 +609,12 @@ void Slit::timeout(void) {
}
Slitmenu::Slitmenu(Slit *sl) : Basemenu(sl->screen) {
slit = sl;
Slitmenu::Slitmenu(Slit &sl) : Basemenu(*sl.screen), slit(sl) {
setLabel(i18n->getMessage(SlitSet, SlitSlitTitle, "Slit"));
setInternalMenu();
directionmenu = new Directionmenu(this);
placementmenu = new Placementmenu(this);
directionmenu = new Directionmenu(*this);
placementmenu = new Placementmenu(*this);
insert(i18n->getMessage(CommonSet, CommonDirectionTitle, "Direction"),
directionmenu);
@ -627,8 +625,8 @@ Slitmenu::Slitmenu(Slit *sl) : Basemenu(sl->screen) {
update();
if (slit->isOnTop()) setItemSelected(2, True);
if (slit->doAutoHide()) setItemSelected(3, True);
if (slit.isOnTop()) setItemSelected(2, True);
if (slit.doAutoHide()) setItemSelected(3, True);
}
@ -647,17 +645,17 @@ void Slitmenu::itemSelected(int button, int index) {
switch (item->function()) {
case 1: { // always on top
Bool change = ((slit->isOnTop()) ? False : True);
slit->on_top = change;
Bool change = ((slit.isOnTop()) ? False : True);
slit.on_top = change;
setItemSelected(2, change);
if (slit->isOnTop()) slit->screen->raiseWindows((Window *) 0, 0);
if (slit.isOnTop()) slit.screen->raiseWindows((Window *) 0, 0);
break;
}
case 2: { // auto hide
Bool change = ((slit->doAutoHide()) ? False : True);
slit->do_auto_hide = change;
Bool change = ((slit.doAutoHide()) ? False : True);
slit.do_auto_hide = change;
setItemSelected(3, change);
break;
@ -668,8 +666,8 @@ void Slitmenu::itemSelected(int button, int index) {
void Slitmenu::internal_hide(void) {
Basemenu::internal_hide();
if (slit->doAutoHide())
slit->timeout();
if (slit.doAutoHide())
slit.timeout();
}
@ -681,10 +679,8 @@ void Slitmenu::reconfigure(void) {
}
Slitmenu::Directionmenu::Directionmenu(Slitmenu *sm)
: Basemenu(sm->slit->screen) {
slitmenu = sm;
Slitmenu::Directionmenu::Directionmenu(Slitmenu &sm)
: Basemenu(*sm.slit.screen), slitmenu(sm) {
setLabel(i18n->getMessage(SlitSet, SlitSlitDirection, "Slit Direction"));
setInternalMenu();
@ -695,7 +691,7 @@ Slitmenu::Directionmenu::Directionmenu(Slitmenu *sm)
update();
if (sm->slit->screen->getSlitDirection() == Slit::Horizontal)
if (sm.slit.screen->getSlitDirection() == Slit::Horizontal)
setItemSelected(0, True);
else
setItemSelected(1, True);
@ -709,7 +705,7 @@ void Slitmenu::Directionmenu::itemSelected(int button, int index) {
BasemenuItem *item = find(index);
if (! item) return;
slitmenu->slit->screen->saveSlitDirection(item->function());
slitmenu.slit.screen->saveSlitDirection(item->function());
if (item->function() == Slit::Horizontal) {
setItemSelected(0, True);
@ -720,13 +716,12 @@ void Slitmenu::Directionmenu::itemSelected(int button, int index) {
}
hide();
slitmenu->slit->reconfigure();
slitmenu.slit.reconfigure();
}
Slitmenu::Placementmenu::Placementmenu(Slitmenu *sm)
: Basemenu(sm->slit->screen) {
slitmenu = sm;
Slitmenu::Placementmenu::Placementmenu(Slitmenu &sm)
: Basemenu(*sm.slit.screen), slitmenu(sm) {
setLabel(i18n->getMessage(SlitSet, SlitSlitPlacement, "Slit Placement"));
setMinimumSublevels(3);
@ -764,9 +759,9 @@ void Slitmenu::Placementmenu::itemSelected(int button, int index) {
BasemenuItem *item = find(index);
if (! (item && item->function())) return;
slitmenu->slit->screen->saveSlitPlacement(item->function());
slitmenu.slit.screen->saveSlitPlacement(item->function());
hide();
slitmenu->slit->reconfigure();
slitmenu.slit.reconfigure();
}

View file

@ -37,30 +37,30 @@ class Slitmenu : public Basemenu {
private:
class Directionmenu : public Basemenu {
private:
Slitmenu *slitmenu;
Slitmenu &slitmenu;
protected:
virtual void itemSelected(int, int);
public:
Directionmenu(Slitmenu *);
Directionmenu(Slitmenu &);
};
class Placementmenu : public Basemenu {
private:
Slitmenu *slitmenu;
Slitmenu &slitmenu;
protected:
virtual void itemSelected(int, int);
public:
Placementmenu(Slitmenu *);
Placementmenu(Slitmenu &);
};
Directionmenu *directionmenu;
Placementmenu *placementmenu;
Slit *slit;
Slit &slit;
friend class Directionmenu;
friend class Placementmenu;
@ -73,7 +73,7 @@ protected:
public:
Slitmenu(Slit *);
Slitmenu(Slit &);
virtual ~Slitmenu(void);
inline Basemenu *getDirectionmenu(void) { return directionmenu; }

View file

@ -33,10 +33,7 @@
#include "BaseDisplay.h"
#include "Timer.h"
BTimer::BTimer(BaseDisplay *d, TimeoutHandler *h) {
display = d;
handler = h;
BTimer::BTimer(BaseDisplay &d, TimeoutHandler &h) : display(d), handler(h) {
once = timing = False;
}
@ -61,16 +58,16 @@ void BTimer::start(void) {
if (! timing) {
timing = True;
display->addTimer(this);
display.addTimer(this);
}
}
void BTimer::stop(void) {
timing = False;
display->removeTimer(this);
display.removeTimer(this);
}
void BTimer::fireTimeout(void) {
if (handler) handler->timeout();
handler.timeout();
}

View file

@ -47,8 +47,8 @@ public:
class BTimer {
friend class BaseDisplay;
private:
BaseDisplay *display;
TimeoutHandler *handler;
BaseDisplay &display;
TimeoutHandler &handler;
int timing, once;
timeval _start, _timeout;
@ -57,7 +57,7 @@ protected:
void fireTimeout(void);
public:
BTimer(BaseDisplay *, TimeoutHandler *);
BTimer(BaseDisplay &, TimeoutHandler &);
virtual ~BTimer(void);
inline const int &isTiming(void) const { return timing; }

View file

@ -69,14 +69,14 @@ Toolbar::Toolbar(BScreen *scrn) {
openbox = screen->getOpenbox();
// get the clock updating every minute
clock_timer = new BTimer(openbox, this);
clock_timer = new BTimer(*openbox, *this);
timeval now;
gettimeofday(&now, 0);
clock_timer->setTimeout((60 - (now.tv_sec % 60)) * 1000);
clock_timer->start();
hide_handler.toolbar = this;
hide_timer = new BTimer(openbox, &hide_handler);
hide_timer = new BTimer(*openbox, hide_handler);
hide_timer->setTimeout(openbox->getAutoRaiseDelay());
hide_timer->fireOnce(True);
@ -90,7 +90,7 @@ Toolbar::Toolbar(BScreen *scrn) {
new_name_pos = 0;
frame.grab_x = frame.grab_y = 0;
toolbarmenu = new Toolbarmenu(this);
toolbarmenu = new Toolbarmenu(*this);
display = openbox->getXDisplay();
XSetWindowAttributes attrib;
@ -1140,13 +1140,11 @@ void Toolbar::HideHandler::timeout(void) {
}
Toolbarmenu::Toolbarmenu(Toolbar *tb) : Basemenu(tb->screen) {
toolbar = tb;
Toolbarmenu::Toolbarmenu(Toolbar &tb) : Basemenu(*tb.screen), toolbar(tb) {
setLabel(i18n->getMessage(ToolbarSet, ToolbarToolbarTitle, "Toolbar"));
setInternalMenu();
placementmenu = new Placementmenu(this);
placementmenu = new Placementmenu(*this);
insert(i18n->getMessage(CommonSet, CommonPlacementTitle, "Placement"),
placementmenu);
@ -1157,8 +1155,8 @@ Toolbarmenu::Toolbarmenu(Toolbar *tb) : Basemenu(tb->screen) {
update();
if (toolbar->isOnTop()) setItemSelected(1, True);
if (toolbar->doAutoHide()) setItemSelected(2, True);
if (toolbar.isOnTop()) setItemSelected(1, True);
if (toolbar.doAutoHide()) setItemSelected(2, True);
}
@ -1176,27 +1174,27 @@ void Toolbarmenu::itemSelected(int button, int index) {
switch (item->function()) {
case 1: { // always on top
Bool change = ((toolbar->isOnTop()) ? False : True);
toolbar->on_top = change;
Bool change = ((toolbar.isOnTop()) ? False : True);
toolbar.on_top = change;
setItemSelected(1, change);
if (toolbar->isOnTop()) toolbar->screen->raiseWindows((Window *) 0, 0);
if (toolbar.isOnTop()) toolbar.screen->raiseWindows((Window *) 0, 0);
break;
}
case 2: { // auto hide
Bool change = ((toolbar->doAutoHide()) ? False : True);
toolbar->do_auto_hide = change;
Bool change = ((toolbar.doAutoHide()) ? False : True);
toolbar.do_auto_hide = change;
setItemSelected(2, change);
#ifdef SLIT
toolbar->screen->getSlit()->reposition();
toolbar.screen->getSlit()->reposition();
#endif // SLIT
break;
}
case 3: { // edit current workspace name
toolbar->edit();
toolbar.edit();
hide();
break;
@ -1207,8 +1205,8 @@ void Toolbarmenu::itemSelected(int button, int index) {
void Toolbarmenu::internal_hide(void) {
Basemenu::internal_hide();
if (toolbar->doAutoHide() && ! toolbar->isEditing())
toolbar->hide_handler.timeout();
if (toolbar.doAutoHide() && ! toolbar.isEditing())
toolbar.hide_handler.timeout();
}
@ -1219,10 +1217,8 @@ void Toolbarmenu::reconfigure(void) {
}
Toolbarmenu::Placementmenu::Placementmenu(Toolbarmenu *tm)
: Basemenu(tm->toolbar->screen) {
toolbarmenu = tm;
Toolbarmenu::Placementmenu::Placementmenu(Toolbarmenu &tm)
: Basemenu(*tm.toolbar.screen), toolbarmenu(tm) {
setLabel(i18n->getMessage(ToolbarSet, ToolbarToolbarPlacement,
"Toolbar Placement"));
setInternalMenu();
@ -1251,13 +1247,13 @@ void Toolbarmenu::Placementmenu::itemSelected(int button, int index) {
BasemenuItem *item = find(index);
if (! item) return;
toolbarmenu->toolbar->screen->saveToolbarPlacement(item->function());
toolbarmenu.toolbar.screen->saveToolbarPlacement(item->function());
hide();
toolbarmenu->toolbar->reconfigure();
toolbarmenu.toolbar.reconfigure();
#ifdef SLIT
// reposition the slit as well to make sure it doesn't intersect the
// toolbar
toolbarmenu->toolbar->screen->getSlit()->reposition();
toolbarmenu.toolbar.screen->getSlit()->reposition();
#endif // SLIT
}

View file

@ -35,16 +35,16 @@ class Toolbarmenu : public Basemenu {
private:
class Placementmenu : public Basemenu {
private:
Toolbarmenu *toolbarmenu;
Toolbarmenu &toolbarmenu;
protected:
virtual void itemSelected(int, int);
public:
Placementmenu(Toolbarmenu *);
Placementmenu(Toolbarmenu &);
};
Toolbar *toolbar;
Toolbar &toolbar;
Placementmenu *placementmenu;
friend class Placementmenu;
@ -56,7 +56,7 @@ protected:
virtual void internal_hide(void);
public:
Toolbarmenu(Toolbar *);
Toolbarmenu(Toolbar &);
~Toolbarmenu(void);
inline Basemenu *getPlacementmenu(void) { return placementmenu; }

View file

@ -152,7 +152,7 @@ OpenboxWindow::OpenboxWindow(Openbox *b, Window w, BScreen *s) {
lastButtonPressTime = 0;
image_ctrl = screen->getImageControl();
timer = new BTimer(openbox, this);
timer = new BTimer(*openbox, *this);
timer->setTimeout(openbox->getAutoRaiseDelay());
timer->fireOnce(True);
@ -280,7 +280,7 @@ OpenboxWindow::OpenboxWindow(Openbox *b, Window w, BScreen *s) {
XMapSubwindows(display, frame.window);
if (decorations.menu)
windowmenu = new Windowmenu(this);
windowmenu = new Windowmenu(*this);
decorate();

View file

@ -42,15 +42,15 @@
#endif // STDC_HEADERS
Windowmenu::Windowmenu(OpenboxWindow *win) : Basemenu(win->getScreen()) {
window = win;
screen = window->getScreen();
Windowmenu::Windowmenu(OpenboxWindow &win) : Basemenu(*win.getScreen()),
window(win), screen(*win.getScreen())
{
setTitleVisibility(False);
setMovable(False);
setInternalMenu();
sendToMenu = new SendtoWorkspacemenu(this);
sendToMenu = new SendtoWorkspacemenu(*this);
insert(i18n->getMessage(WindowmenuSet, WindowmenuSendTo, "Send To ..."),
sendToMenu);
insert(i18n->getMessage(WindowmenuSet, WindowmenuShade, "Shade"),
@ -72,10 +72,10 @@ Windowmenu::Windowmenu(OpenboxWindow *win) : Basemenu(win->getScreen()) {
update();
setItemEnabled(1, window->hasTitlebar());
setItemEnabled(2, window->isIconifiable());
setItemEnabled(3, window->isMaximizable());
setItemEnabled(8, window->isClosable());
setItemEnabled(1, window.hasTitlebar());
setItemEnabled(2, window.isIconifiable());
setItemEnabled(3, window.isMaximizable());
setItemEnabled(8, window.isClosable());
}
@ -85,9 +85,9 @@ Windowmenu::~Windowmenu(void) {
void Windowmenu::show(void) {
if (isItemEnabled(1)) setItemSelected(1, window->isShaded());
if (isItemEnabled(3)) setItemSelected(3, window->isMaximized());
if (isItemEnabled(6)) setItemSelected(6, window->isStuck());
if (isItemEnabled(1)) setItemSelected(1, window.isShaded());
if (isItemEnabled(3)) setItemSelected(3, window.isMaximized());
if (isItemEnabled(6)) setItemSelected(6, window.isStuck());
Basemenu::show();
}
@ -106,50 +106,50 @@ void Windowmenu::itemSelected(int button, int index) {
hide();
switch (item->function()) {
case BScreen::WindowShade:
window->shade();
window.shade();
break;
case BScreen::WindowIconify:
window->iconify();
window.iconify();
break;
case BScreen::WindowMaximize:
window->maximize((unsigned int) button);
window.maximize((unsigned int) button);
break;
case BScreen::WindowClose:
window->close();
window.close();
break;
case BScreen::WindowRaise:
screen->getWorkspace(window->getWorkspaceNumber())->raiseWindow(window);
screen.getWorkspace(window.getWorkspaceNumber())->raiseWindow(&window);
break;
case BScreen::WindowLower:
screen->getWorkspace(window->getWorkspaceNumber())->lowerWindow(window);
screen.getWorkspace(window.getWorkspaceNumber())->lowerWindow(&window);
break;
case BScreen::WindowStick:
window->stick();
window.stick();
break;
case BScreen::WindowKill:
XKillClient(screen->getBaseDisplay()->getXDisplay(),
window->getClientWindow());
XKillClient(screen.getBaseDisplay()->getXDisplay(),
window.getClientWindow());
break;
}
} else if (item->function() == BScreen::WindowMaximize) {
hide();
window->maximize((unsigned int) button);
window.maximize((unsigned int) button);
}
}
void Windowmenu::reconfigure(void) {
setItemEnabled(1, window->hasTitlebar());
setItemEnabled(2, window->isIconifiable());
setItemEnabled(3, window->isMaximizable());
setItemEnabled(8, window->isClosable());
setItemEnabled(1, window.hasTitlebar());
setItemEnabled(2, window.isIconifiable());
setItemEnabled(3, window.isMaximizable());
setItemEnabled(8, window.isClosable());
sendToMenu->reconfigure();
@ -157,10 +157,8 @@ void Windowmenu::reconfigure(void) {
}
Windowmenu::SendtoWorkspacemenu::SendtoWorkspacemenu(Windowmenu *w)
: Basemenu(w->screen) {
windowmenu = w;
Windowmenu::SendtoWorkspacemenu::SendtoWorkspacemenu(Windowmenu &w)
: Basemenu(w.screen), windowmenu(w) {
setTitleVisibility(False);
setMovable(False);
setInternalMenu();
@ -171,13 +169,13 @@ Windowmenu::SendtoWorkspacemenu::SendtoWorkspacemenu(Windowmenu *w)
void Windowmenu::SendtoWorkspacemenu::itemSelected(int button, int index) {
if (button > 2) return;
if (index <= windowmenu->screen->getWorkspaceCount()) {
if (index == windowmenu->screen->getCurrentWorkspaceID()) return;
if (windowmenu->window->isStuck()) windowmenu->window->stick();
if (index <= windowmenu.screen.getWorkspaceCount()) {
if (index == windowmenu.screen.getCurrentWorkspaceID()) return;
if (windowmenu.window.isStuck()) windowmenu.window.stick();
if (button == 1) windowmenu->window->withdraw();
windowmenu->screen->reassociateWindow(windowmenu->window, index, True);
if (button == 2) windowmenu->screen->changeWorkspaceID(index);
if (button == 1) windowmenu.window.withdraw();
windowmenu.screen.reassociateWindow(&(windowmenu.window), index, True);
if (button == 2) windowmenu.screen.changeWorkspaceID(index);
}
hide();
}
@ -190,8 +188,8 @@ void Windowmenu::SendtoWorkspacemenu::update(void) {
for (i = 0; i < r; ++i)
remove(0);
for (i = 0; i < windowmenu->screen->getWorkspaceCount(); ++i)
insert(windowmenu->screen->getWorkspace(i)->getName());
for (i = 0; i < windowmenu.screen.getWorkspaceCount(); ++i)
insert(windowmenu.screen.getWorkspace(i)->getName());
Basemenu::update();
}

View file

@ -35,18 +35,18 @@ class Toolbar;
class Windowmenu : public Basemenu {
private:
OpenboxWindow *window;
BScreen *screen;
OpenboxWindow &window;
BScreen &screen;
class SendtoWorkspacemenu : public Basemenu {
private:
Windowmenu *windowmenu;
Windowmenu &windowmenu;
protected:
virtual void itemSelected(int, int);
public:
SendtoWorkspacemenu(Windowmenu *);
SendtoWorkspacemenu(Windowmenu &);
void update(void);
@ -63,7 +63,7 @@ protected:
public:
Windowmenu(OpenboxWindow *);
Windowmenu(OpenboxWindow &);
virtual ~Windowmenu(void);
inline Basemenu *getSendToMenu(void) { return (Basemenu *) sendToMenu; }

View file

@ -68,7 +68,7 @@ Workspace::Workspace(BScreen *scrn, int i) {
stackingList = new LinkedList<OpenboxWindow>;
windowList = new LinkedList<OpenboxWindow>;
clientmenu = new Clientmenu(this);
clientmenu = new Clientmenu(*this);
lastfocus = (OpenboxWindow *) 0;

View file

@ -38,9 +38,7 @@
#include "Workspace.h"
Workspacemenu::Workspacemenu(BScreen *scrn) : Basemenu(scrn) {
screen = scrn;
Workspacemenu::Workspacemenu(BScreen &scrn) : Basemenu(scrn), screen(scrn) {
setInternalMenu();
setLabel(i18n->getMessage(WorkspacemenuSet, WorkspacemenuWorkspacesTitle,
@ -57,13 +55,13 @@ void Workspacemenu::itemSelected(int button, int index) {
return;
if (index == 0)
screen->addWorkspace();
screen.addWorkspace();
else if (index == 1)
screen->removeLastWorkspace();
else if ((screen->getCurrentWorkspace()->getWorkspaceID() !=
(index - 2)) && ((index - 2) < screen->getWorkspaceCount()))
screen->changeWorkspaceID(index - 2);
screen.removeLastWorkspace();
else if ((screen.getCurrentWorkspace()->getWorkspaceID() !=
(index - 2)) && ((index - 2) < screen.getWorkspaceCount()))
screen.changeWorkspaceID(index - 2);
if (! (screen->getWorkspacemenu()->isTorn() || isTorn()))
if (! (screen.getWorkspacemenu()->isTorn() || isTorn()))
hide();
}

View file

@ -31,13 +31,13 @@ class Toolbar;
class Workspacemenu : public Basemenu {
private:
BScreen *screen;
BScreen &screen;
protected:
virtual void itemSelected(int, int);
public:
Workspacemenu(BScreen *);
Workspacemenu(BScreen &);
};

View file

@ -228,7 +228,7 @@ Openbox::Openbox(int m_argc, char **m_argv, char *dpy_name, char *rc)
reconfigure_wait = reread_menu_wait = False;
timer = new BTimer(this, this);
timer = new BTimer(*this, *this);
timer->setTimeout(0);
timer->fireOnce(True);