fixed som indentation,throw statement in constructor and variable init
This commit is contained in:
parent
f16075f277
commit
e0f3b3caff
1 changed files with 82 additions and 73 deletions
117
src/Window.cc
117
src/Window.cc
|
@ -22,7 +22,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// $Id: Window.cc,v 1.19 2002/01/11 17:01:31 fluxgen Exp $
|
// $Id: Window.cc,v 1.20 2002/01/18 01:25:58 fluxgen Exp $
|
||||||
|
|
||||||
// stupid macros needed to access some functions in version 2 of the GNU C
|
// stupid macros needed to access some functions in version 2 of the GNU C
|
||||||
// library
|
// library
|
||||||
|
@ -41,7 +41,6 @@
|
||||||
#include "Toolbar.hh"
|
#include "Toolbar.hh"
|
||||||
#include "Window.hh"
|
#include "Window.hh"
|
||||||
#include "Windowmenu.hh"
|
#include "Windowmenu.hh"
|
||||||
#include "Workspace.hh"
|
|
||||||
#include "StringUtil.hh"
|
#include "StringUtil.hh"
|
||||||
|
|
||||||
#ifdef SLIT
|
#ifdef SLIT
|
||||||
|
@ -65,7 +64,18 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
FluxboxWindow::FluxboxWindow(Window w, BScreen *s) {
|
FluxboxWindow::FluxboxWindow(Window w, BScreen *s):
|
||||||
|
image_ctrl(0),
|
||||||
|
moving(false), resizing(false), shaded(false), maximized(false),
|
||||||
|
visible(false), iconic(false), transient(false), focused(false),
|
||||||
|
stuck(false), modal(false), send_focus_message(false), managed(false),
|
||||||
|
screen(0),
|
||||||
|
timer(0),
|
||||||
|
display(0),
|
||||||
|
lastButtonPressTime(0),
|
||||||
|
windowmenu(0),
|
||||||
|
tab(0)
|
||||||
|
{
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
|
@ -83,9 +93,6 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen *s) {
|
||||||
Fluxbox *fluxbox = Fluxbox::instance();
|
Fluxbox *fluxbox = Fluxbox::instance();
|
||||||
display = fluxbox->getXDisplay();
|
display = fluxbox->getXDisplay();
|
||||||
|
|
||||||
moving = resizing = shaded = maximized = visible = iconic = false;
|
|
||||||
transient = focused = stuck = modal = send_focus_message = managed = false;
|
|
||||||
|
|
||||||
blackbox_attrib.workspace = workspace_number = window_number = -1;
|
blackbox_attrib.workspace = workspace_number = window_number = -1;
|
||||||
|
|
||||||
blackbox_attrib.flags = blackbox_attrib.attrib = blackbox_attrib.stack = 0l;
|
blackbox_attrib.flags = blackbox_attrib.attrib = blackbox_attrib.stack = 0l;
|
||||||
|
@ -94,7 +101,6 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen *s) {
|
||||||
//use tab as default
|
//use tab as default
|
||||||
decorations.tab = true;
|
decorations.tab = true;
|
||||||
client.window = w;
|
client.window = w;
|
||||||
tab = 0;
|
|
||||||
frame.window = frame.plate = frame.title = frame.handle = None;
|
frame.window = frame.plate = frame.title = frame.handle = None;
|
||||||
frame.right_grip = frame.left_grip = None;
|
frame.right_grip = frame.left_grip = None;
|
||||||
|
|
||||||
|
@ -147,12 +153,6 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen *s) {
|
||||||
client.mwm_hint = (MwmHints *) 0;
|
client.mwm_hint = (MwmHints *) 0;
|
||||||
client.blackbox_hint = 0;
|
client.blackbox_hint = 0;
|
||||||
|
|
||||||
windowmenu = 0;
|
|
||||||
lastButtonPressTime = 0;
|
|
||||||
timer = 0;
|
|
||||||
screen = 0;
|
|
||||||
image_ctrl = 0;
|
|
||||||
|
|
||||||
fluxbox->grab();
|
fluxbox->grab();
|
||||||
if (! validateClient())
|
if (! validateClient())
|
||||||
return;
|
return;
|
||||||
|
@ -161,23 +161,8 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen *s) {
|
||||||
XWindowAttributes wattrib;
|
XWindowAttributes wattrib;
|
||||||
if ((! XGetWindowAttributes(display, client.window, &wattrib)) ||
|
if ((! XGetWindowAttributes(display, client.window, &wattrib)) ||
|
||||||
(! wattrib.screen) || wattrib.override_redirect) {
|
(! wattrib.screen) || wattrib.override_redirect) {
|
||||||
#ifdef DEBUG
|
|
||||||
fprintf(stderr,
|
|
||||||
I18n::instance()->
|
|
||||||
getMessage(
|
|
||||||
# ifdef NLS
|
|
||||||
WindowSet, WindowXGetWindowAttributesFail,
|
|
||||||
# else // !NLS
|
|
||||||
0, 0,
|
|
||||||
# endif // NLS
|
|
||||||
"FluxboxWindow::FluxboxWindow(): XGetWindowAttributes "
|
|
||||||
"failed\n"));
|
|
||||||
#endif // DEBUG
|
|
||||||
|
|
||||||
delete this;
|
|
||||||
|
|
||||||
fluxbox->ungrab();
|
fluxbox->ungrab();
|
||||||
return;
|
throw FluxboxWindow::XGETWINDOWATTRIB;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s)
|
if (s)
|
||||||
|
@ -185,24 +170,9 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen *s) {
|
||||||
else
|
else
|
||||||
screen = fluxbox->searchScreen(RootWindowOfScreen(wattrib.screen));
|
screen = fluxbox->searchScreen(RootWindowOfScreen(wattrib.screen));
|
||||||
|
|
||||||
if (! screen) {
|
if (!screen) {
|
||||||
#ifdef DEBUG
|
|
||||||
fprintf(stderr,
|
|
||||||
I18n::instance()->
|
|
||||||
getMessage(
|
|
||||||
# ifdef NLS
|
|
||||||
WindowSet, WindowCannotFindScreen,
|
|
||||||
# else // !NLS
|
|
||||||
0, 0,
|
|
||||||
# endif // NLS
|
|
||||||
"FluxboxWindow::FluxboxWindow(): can't find screen\n"
|
|
||||||
" for root window 0x%lx\n"),
|
|
||||||
RootWindowOfScreen(wattrib.screen));
|
|
||||||
#endif // DEBUG
|
|
||||||
delete this;
|
|
||||||
|
|
||||||
fluxbox->ungrab();
|
fluxbox->ungrab();
|
||||||
return;
|
throw FluxboxWindow::CANTFINDSCREEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
image_ctrl = screen->getImageControl();
|
image_ctrl = screen->getImageControl();
|
||||||
|
@ -230,10 +200,8 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen *s) {
|
||||||
#ifdef SLIT
|
#ifdef SLIT
|
||||||
if (client.initial_state == WithdrawnState) {
|
if (client.initial_state == WithdrawnState) {
|
||||||
screen->getSlit()->addClient(client.window);
|
screen->getSlit()->addClient(client.window);
|
||||||
delete this;
|
|
||||||
|
|
||||||
fluxbox->ungrab();
|
fluxbox->ungrab();
|
||||||
return;
|
throw NOERROR;
|
||||||
}
|
}
|
||||||
#endif // SLIT
|
#endif // SLIT
|
||||||
|
|
||||||
|
@ -429,6 +397,7 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen *s) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "%s(%d): FluxboxWindow(this=%p)\n", __FILE__, __LINE__, this);
|
fprintf(stderr, "%s(%d): FluxboxWindow(this=%p)\n", __FILE__, __LINE__, this);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//TODO move this
|
//TODO move this
|
||||||
#ifdef GNOME
|
#ifdef GNOME
|
||||||
int val = workspace_number;
|
int val = workspace_number;
|
||||||
|
@ -442,6 +411,9 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen *s) {
|
||||||
FluxboxWindow::~FluxboxWindow(void) {
|
FluxboxWindow::~FluxboxWindow(void) {
|
||||||
Fluxbox *fluxbox = Fluxbox::instance();
|
Fluxbox *fluxbox = Fluxbox::instance();
|
||||||
|
|
||||||
|
//TODO: Move this to Workspace::removeWindow
|
||||||
|
if (client.transient_for)
|
||||||
|
fluxbox->setFocusedWindow(client.transient_for);
|
||||||
|
|
||||||
if (moving || resizing) {
|
if (moving || resizing) {
|
||||||
screen->hideGeometry();
|
screen->hideGeometry();
|
||||||
|
@ -527,9 +499,9 @@ FluxboxWindow::~FluxboxWindow(void) {
|
||||||
fluxbox->removeWindowSearch(frame.handle);
|
fluxbox->removeWindowSearch(frame.handle);
|
||||||
fluxbox->removeWindowSearch(frame.right_grip);
|
fluxbox->removeWindowSearch(frame.right_grip);
|
||||||
fluxbox->removeWindowSearch(frame.left_grip);
|
fluxbox->removeWindowSearch(frame.left_grip);
|
||||||
|
XDestroyWindow(display, frame.handle);
|
||||||
XDestroyWindow(display, frame.right_grip);
|
XDestroyWindow(display, frame.right_grip);
|
||||||
XDestroyWindow(display, frame.left_grip);
|
XDestroyWindow(display, frame.left_grip);
|
||||||
XDestroyWindow(display, frame.handle);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frame.fbutton)
|
if (frame.fbutton)
|
||||||
|
@ -556,14 +528,46 @@ FluxboxWindow::~FluxboxWindow(void) {
|
||||||
fluxbox->removeWindowSearch(client.window);
|
fluxbox->removeWindowSearch(client.window);
|
||||||
screen->removeNetizen(client.window);
|
screen->removeNetizen(client.window);
|
||||||
}
|
}
|
||||||
//TODO: Move this to Workspace::removeWindow
|
|
||||||
if (client.transient_for)
|
|
||||||
fluxbox->setFocusedWindow(client.transient_for);
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "%s(%d): ~FluxboxWindow(this=%p) done\n", __FILE__, __LINE__, this);
|
fprintf(stderr, "%s(%d): ~FluxboxWindow(this=%p) done\n", __FILE__, __LINE__, this);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FluxboxWindow::showError(FluxboxWindow::Error error) {
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
switch (error) {
|
||||||
|
case NOERROR:
|
||||||
|
break;
|
||||||
|
case XGETWINDOWATTRIB:
|
||||||
|
fprintf(stderr,
|
||||||
|
I18n::instance()->
|
||||||
|
getMessage(
|
||||||
|
#ifdef NLS
|
||||||
|
WindowSet, WindowXGetWindowAttributesFail,
|
||||||
|
#else // !NLS
|
||||||
|
0, 0,
|
||||||
|
#endif // NLS
|
||||||
|
"FluxboxWindow::FluxboxWindow(): XGetWindowAttributes "
|
||||||
|
"failed\n")
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case CANTFINDSCREEN:
|
||||||
|
fprintf(stderr,
|
||||||
|
I18n::instance()->
|
||||||
|
getMessage(
|
||||||
|
#ifdef NLS
|
||||||
|
WindowSet, WindowCannotFindScreen,
|
||||||
|
#else // !NLS
|
||||||
|
0, 0,
|
||||||
|
#endif // NLS
|
||||||
|
"FluxboxWindow::FluxboxWindow(): can't find screen\n"
|
||||||
|
" for root window"));
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
#endif // DEBUG
|
||||||
|
}
|
||||||
|
|
||||||
Window FluxboxWindow::createToplevelWindow(int x, int y, unsigned int width,
|
Window FluxboxWindow::createToplevelWindow(int x, int y, unsigned int width,
|
||||||
unsigned int height,
|
unsigned int height,
|
||||||
|
@ -1704,8 +1708,13 @@ void FluxboxWindow::setTab(bool flag) {
|
||||||
decorations.tab = flag;
|
decorations.tab = flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------- iconify ----------------
|
||||||
|
// Unmaps the window and removes it from workspace list
|
||||||
|
//--------------------------------------
|
||||||
void FluxboxWindow::iconify(void) {
|
void FluxboxWindow::iconify(void) {
|
||||||
if (iconic) return;
|
|
||||||
|
if (iconic)
|
||||||
|
return;
|
||||||
|
|
||||||
if (windowmenu)
|
if (windowmenu)
|
||||||
windowmenu->hide();
|
windowmenu->hide();
|
||||||
|
|
Loading…
Reference in a new issue