_WIN_WORKSPACE atom and some indent

This commit is contained in:
fluxgen 2002-02-04 06:53:14 +00:00
parent ae9d3d84c9
commit 7b175210c8

View file

@ -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.23 2002/01/27 13:13:33 fluxgen Exp $ // $Id: Window.cc,v 1.24 2002/02/04 06:53:14 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
@ -162,7 +162,6 @@ tab(0)
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) {
//fluxbox->ungrab();
throw FluxboxWindow::XGETWINDOWATTRIB; throw FluxboxWindow::XGETWINDOWATTRIB;
} }
@ -392,27 +391,28 @@ tab(0)
} }
setFocusFlag(false); setFocusFlag(false);
/*
#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;
XChangeProperty(display, client.window, screen->getBaseDisplay()->getGnomeWorkspaceAtom(), XA_CARDINAL, 32, XChangeProperty(display, client.window, screen->getBaseDisplay()->getGnomeWorkspaceAtom(),
PropModeReplace, (unsigned char *)&val, 1); XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&val, 1);
#endif #endif
} }
FluxboxWindow::~FluxboxWindow(void) { FluxboxWindow::~FluxboxWindow(void) {
#ifdef GNOME
XDeleteProperty (display, client.window, screen->getBaseDisplay()->getGnomeWorkspaceAtom());
#endif
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();
@ -448,6 +448,9 @@ FluxboxWindow::~FluxboxWindow(void) {
if (client.blackbox_hint) if (client.blackbox_hint)
XFree(client.blackbox_hint); XFree(client.blackbox_hint);
//TODO: Move this to Workspace::removeWindow
if (client.transient_for)
fluxbox->setFocusedWindow(client.transient_for);
if (client.window_group) if (client.window_group)
fluxbox->removeGroupSearch(client.window_group); fluxbox->removeGroupSearch(client.window_group);
@ -593,8 +596,7 @@ Window FluxboxWindow::createToplevelWindow(int x, int y, unsigned int width,
Window FluxboxWindow::createChildWindow(Window parent, Cursor cursor) { Window FluxboxWindow::createChildWindow(Window parent, Cursor cursor) {
XSetWindowAttributes attrib_create; XSetWindowAttributes attrib_create;
unsigned long create_mask = CWBackPixmap | CWBorderPixel | unsigned long create_mask = CWBackPixmap | CWBorderPixel | CWEventMask;
CWEventMask;
attrib_create.background_pixmap = None; attrib_create.background_pixmap = None;
attrib_create.event_mask = ButtonPressMask | ButtonReleaseMask | attrib_create.event_mask = ButtonPressMask | ButtonReleaseMask |
@ -626,10 +628,10 @@ void FluxboxWindow::associateClientWindow(void) {
XFlush(display); XFlush(display);
attrib_set.event_mask = PropertyChangeMask | StructureNotifyMask | attrib_set.event_mask =
FocusChangeMask; PropertyChangeMask | StructureNotifyMask | FocusChangeMask;
attrib_set.do_not_propagate_mask = ButtonPressMask | ButtonReleaseMask | attrib_set.do_not_propagate_mask =
ButtonMotionMask; ButtonPressMask | ButtonReleaseMask | ButtonMotionMask;
XChangeWindowAttributes(display, client.window, CWEventMask|CWDontPropagate, XChangeWindowAttributes(display, client.window, CWEventMask|CWDontPropagate,
&attrib_set); &attrib_set);
@ -671,10 +673,11 @@ void FluxboxWindow::associateClientWindow(void) {
#endif // SHAPE #endif // SHAPE
//create the buttons //create the buttons
if (decorations.iconify) if (decorations.iconify)
createButton(Fluxbox::MINIMIZE, FluxboxWindow::iconifyPressed_cb, FluxboxWindow::iconifyButton_cb, FluxboxWindow::iconifyDraw_cb); createButton(Fluxbox::MINIMIZE, FluxboxWindow::iconifyPressed_cb,
FluxboxWindow::iconifyButton_cb, FluxboxWindow::iconifyDraw_cb);
if (decorations.maximize) if (decorations.maximize)
createButton(Fluxbox::MAXIMIZE, FluxboxWindow::maximizePressed_cb, FluxboxWindow::maximizeButton_cb, createButton(Fluxbox::MAXIMIZE, FluxboxWindow::maximizePressed_cb,
FluxboxWindow::maximizeDraw_cb); FluxboxWindow::maximizeButton_cb, FluxboxWindow::maximizeDraw_cb);
if (decorations.close) if (decorations.close)
createButton(Fluxbox::CLOSE, FluxboxWindow::closePressed_cb, createButton(Fluxbox::CLOSE, FluxboxWindow::closePressed_cb,
FluxboxWindow::closeButton_cb, FluxboxWindow::closeDraw_cb); FluxboxWindow::closeButton_cb, FluxboxWindow::closeDraw_cb);
@ -860,10 +863,10 @@ void FluxboxWindow::createButton(int type, ButtonEventProc pressed, ButtonEventP
} }
Window FluxboxWindow::findTitleButton(int type) { Window FluxboxWindow::findTitleButton(int type) {
for (unsigned int i=0; i<buttonlist.size(); i++) for (unsigned int i=0; i<buttonlist.size(); i++) {
if (buttonlist[i].type == type) if (buttonlist[i].type == type)
return buttonlist[i].win; return buttonlist[i].win;
}
return 0; return 0;
} }
void FluxboxWindow::stickyButton_cb(FluxboxWindow *t, XButtonEvent *be) { void FluxboxWindow::stickyButton_cb(FluxboxWindow *t, XButtonEvent *be) {
@ -933,7 +936,6 @@ void FluxboxWindow::iconifyDraw_cb(FluxboxWindow *t, Window w, bool pressed) {
((t->focused) ? t->screen->getWindowStyle()->b_pic_focus_gc : ((t->focused) ? t->screen->getWindowStyle()->b_pic_focus_gc :
t->screen->getWindowStyle()->b_pic_unfocus_gc), t->screen->getWindowStyle()->b_pic_unfocus_gc),
2, t->frame.button_h - 5, t->frame.button_w - 5, 2); 2, t->frame.button_h - 5, t->frame.button_w - 5, 2);
} }
void FluxboxWindow::maximizeDraw_cb(FluxboxWindow *t, Window w, bool pressed) { void FluxboxWindow::maximizeDraw_cb(FluxboxWindow *t, Window w, bool pressed) {
@ -1537,6 +1539,10 @@ void FluxboxWindow::getBlackboxHints(void) {
void FluxboxWindow::configure(int dx, int dy, void FluxboxWindow::configure(int dx, int dy,
unsigned int dw, unsigned int dh) { unsigned int dw, unsigned int dh) {
//we don't want negative size
if (dw <0 || dh<0)
return;
bool send_event = (frame.x != dx || frame.y != dy); bool send_event = (frame.x != dx || frame.y != dy);
if ((dw != frame.width) || (dh != frame.height)) { if ((dw != frame.width) || (dh != frame.height)) {
@ -2079,7 +2085,8 @@ void FluxboxWindow::stick(void) {
blackbox_attrib.attrib |= BaseDisplay::ATTRIB_OMNIPRESENT; blackbox_attrib.attrib |= BaseDisplay::ATTRIB_OMNIPRESENT;
} }
//find a STICK button in window
redrawAllButtons();
setState(current_state); setState(current_state);
} }
@ -3099,7 +3106,7 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent *me) {
resizing = true; resizing = true;
fluxbox->grab(); // fluxbox->grab();
int gx, gy; int gx, gy;
frame.grab_x = me->x - screen->getBorderWidth(); frame.grab_x = me->x - screen->getBorderWidth();