]> Dogcows Code - chaz/openbox/blobdiff - src/window.cc
oops
[chaz/openbox] / src / window.cc
index 206e66c6983b5a064f4729e095ad9f1175be2e5a..e7f5db1d5b2a679bc6ee82897cf6b15087b9ae9d 100644 (file)
@@ -1,25 +1,4 @@
 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
-// Window.cc for Blackbox - an X11 Window manager
-// Copyright (c) 2001 - 2002 Sean 'Shaleh' Perry <shaleh at debian.org>
-// Copyright (c) 1997 - 2000, 2002 Brad Hughes <bhughes at trolltech.com>
-//
-// 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"
@@ -45,18 +24,13 @@ extern "C" {
 }
 
 #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"
 
 using std::string;
 using std::abs;
@@ -149,8 +123,6 @@ BlackboxWindow::BlackboxWindow(Blackbox *b, Window w, BScreen *s) {
 
   current_state = NormalState;
 
-  windowmenu = 0;
-
   /*
     set the initial size and location of client window (relative to the
     _root window_). This position is the reference point used with the
@@ -331,9 +303,6 @@ BlackboxWindow::BlackboxWindow(Blackbox *b, Window w, BScreen *s) {
 
   if (flags.maximized && (functions & Func_Maximize))
     remaximize();
-
-  // create this last so it only needs to be configured once
-  windowmenu = new Windowmenu(this);
 }
 
 
@@ -359,8 +328,6 @@ BlackboxWindow::~BlackboxWindow(void) {
 
   delete timer;
 
-  delete windowmenu;
-
   if (client.window_group) {
     BWindowGroup *group = blackbox->searchGroup(client.window_group);
     if (group) group->removeWindow(this);
@@ -974,11 +941,6 @@ void BlackboxWindow::reconfigure(void) {
 
   ungrabButtons();
   grabButtons();
-
-  if (windowmenu) {
-    windowmenu->move(windowmenu->getX(), frame.rect.y() + frame.title_h);
-    windowmenu->reconfigure();
-  }
 }
 
 
@@ -1161,7 +1123,7 @@ void BlackboxWindow::getWMName(void) {
     return;
   }
   // fall back to an internal default
-  client.title = i18n(WindowSet, WindowUnnamed, "Unnamed");
+  client.title = "Unnamed";
   xatom->setValue(client.window, XAtom::net_wm_visible_name, XAtom::utf8,
                   client.title);
 
@@ -1215,8 +1177,6 @@ void BlackboxWindow::getWMProtocols(void) {
         functions |= Func_Close;
       } else if (proto[i] == xatom->getAtom(XAtom::wm_take_focus))
         flags.send_focus_message = True;
-      else if (proto[i] == xatom->getAtom(XAtom::blackbox_structure_messages))
-        screen->addNetizen(new Netizen(screen, client.window));
     }
 
     XFree(proto);
@@ -1669,7 +1629,6 @@ void BlackboxWindow::configure(int dx, int dy,
 
     XSendEvent(blackbox->getXDisplay(), client.window, False,
                StructureNotifyMask, &event);
-    screen->updateNetizenConfigNotify(&event);
     XFlush(blackbox->getXDisplay());
   }
 }
@@ -1783,8 +1742,6 @@ void BlackboxWindow::iconify(void) {
   if (flags.moving)
     endMove();
     
-  if (windowmenu) windowmenu->hide();
-
   /*
    * we don't want this XUnmapWindow call to generate an UnmapNotify event, so
    * we need to clear the event mask on client.window for a split second.
@@ -1921,8 +1878,6 @@ void BlackboxWindow::withdraw(void) {
   XSelectInput(blackbox->getXDisplay(), client.window, event_mask);
 
   XUngrabServer(blackbox->getXDisplay());
-
-  if (windowmenu) windowmenu->hide();
 }
 
 
@@ -1934,9 +1889,6 @@ void BlackboxWindow::maximize(unsigned int button) {
   if (flags.moving)
     endMove();
 
-  // handle case where menu is open then the max button is used instead
-  if (windowmenu && windowmenu->isVisible()) windowmenu->hide();
-
   if (flags.maximized) {
     flags.maximized = 0;
 
@@ -2257,15 +2209,6 @@ void BlackboxWindow::setFocusFlag(bool focus) {
 
   if (flags.focused)
     blackbox->setFocusedWindow(this);
-  if (! flags.iconic) {
-    // iconic windows arent in a workspace menu!
-    if (flags.stuck)
-      screen->getCurrentWorkspace()->setFocused(this, isFocused());
-    else
-      screen->getWorkspace(blackbox_attrib.workspace)->
-        setFocused(this, flags.focused);
-  }
 }
 
 
@@ -2667,7 +2610,6 @@ void BlackboxWindow::redrawIconifyButton(bool pressed) const {
   BPen pen((flags.focused) ? screen->getWindowStyle()->b_pic_focus :
              screen->getWindowStyle()->b_pic_unfocus);
 
-#ifdef    BITMAPBUTTONS
   PixmapMask pm = screen->getWindowStyle()->icon_button;
   
   if (screen->getWindowStyle()->icon_button.mask != None) {
@@ -2682,12 +2624,9 @@ void BlackboxWindow::redrawIconifyButton(bool pressed) const {
     XSetClipMask(blackbox->getXDisplay(), pen.gc(), None);
     XSetClipOrigin(blackbox->getXDisplay(), pen.gc(), 0, 0);
   } else {
-#endif // BITMAPBUTTONS
     XDrawRectangle(blackbox->getXDisplay(), frame.iconify_button, pen.gc(),
                    2, (frame.button_w - 5), (frame.button_w - 5), 2);
-#ifdef    BITMAPBUTTONS
   }
-#endif // BITMAPBUTTONS
 }
 
 
@@ -2703,7 +2642,6 @@ void BlackboxWindow::redrawMaximizeButton(bool pressed) const {
   BPen pen((flags.focused) ? screen->getWindowStyle()->b_pic_focus :
            screen->getWindowStyle()->b_pic_unfocus);
   
-#ifdef    BITMAPBUTTONS
   PixmapMask pm = screen->getWindowStyle()->max_button;
     
   if (pm.mask != None) {
@@ -2718,14 +2656,11 @@ void BlackboxWindow::redrawMaximizeButton(bool pressed) const {
     XSetClipOrigin(blackbox->getXDisplay(), pen.gc(), 0, 0 );
     XSetClipMask( blackbox->getXDisplay(), pen.gc(), None );
   } else {
-#endif // BITMAPBUTTONS
     XDrawRectangle(blackbox->getXDisplay(), frame.maximize_button, pen.gc(),
                    2, 2, (frame.button_w - 5), (frame.button_w - 5));
     XDrawLine(blackbox->getXDisplay(), frame.maximize_button, pen.gc(),
               2, 3, (frame.button_w - 3), 3);
-#ifdef    BITMAPBUTTONS
   }
-#endif // BITMAPBUTTONS
 }
 
 
@@ -2741,7 +2676,6 @@ void BlackboxWindow::redrawCloseButton(bool pressed) const {
   BPen pen((flags.focused) ? screen->getWindowStyle()->b_pic_focus :
            screen->getWindowStyle()->b_pic_unfocus);
   
-#ifdef    BITMAPBUTTONS
   PixmapMask pm = screen->getWindowStyle()->close_button;
 
   if (pm.mask != None) {
@@ -2757,14 +2691,11 @@ void BlackboxWindow::redrawCloseButton(bool pressed) const {
     XSetClipOrigin(blackbox->getXDisplay(), pen.gc(), 0, 0 );
     XSetClipMask( blackbox->getXDisplay(), pen.gc(), None );
   } else {
-#endif // BITMAPBUTTONS
     XDrawLine(blackbox->getXDisplay(), frame.close_button, pen.gc(),
               2, 2, (frame.button_w - 3), (frame.button_w - 3));
     XDrawLine(blackbox->getXDisplay(), frame.close_button, pen.gc(),
               2, (frame.button_w - 3), (frame.button_w - 3), 2);
-#ifdef    BITMAPBUTTONS
   }
-#endif // BITMAPBUTTONS
 }
 
 void BlackboxWindow::redrawStickyButton(bool pressed) const {
@@ -2779,7 +2710,6 @@ void BlackboxWindow::redrawStickyButton(bool pressed) const {
   BPen pen((flags.focused) ? screen->getWindowStyle()->b_pic_focus :
            screen->getWindowStyle()->b_pic_unfocus);
   
-#ifdef    BITMAPBUTTONS
   PixmapMask pm = screen->getWindowStyle()->stick_button;
 
   if (pm.mask != None) {
@@ -2795,12 +2725,9 @@ void BlackboxWindow::redrawStickyButton(bool pressed) const {
     XSetClipOrigin(blackbox->getXDisplay(), pen.gc(), 0, 0 );
     XSetClipMask( blackbox->getXDisplay(), pen.gc(), None );
   } else {
-#endif // BITMAPBUTTONS
     XFillRectangle(blackbox->getXDisplay(), frame.stick_button, pen.gc(),
                    frame.button_w/2 - 1, frame.button_w/2 -1, 2, 2 );
-#ifdef    BITMAPBUTTONS
   }
-#endif
 }
 
 void BlackboxWindow::mapRequestEvent(const XMapRequestEvent *re) {
@@ -2994,7 +2921,6 @@ void BlackboxWindow::propertyNotifyEvent(const XPropertyEvent *pe) {
           positionButtons(True);
           XMapSubwindows(blackbox->getXDisplay(), frame.title);
         }
-        if (windowmenu) windowmenu->reconfigure();
       }
     } else if (pe->atom == xatom->getAtom(XAtom::net_wm_strut)) {
       updateStrut();
@@ -3116,8 +3042,6 @@ void BlackboxWindow::buttonPressEvent(const XButtonEvent *be) {
     } else if (frame.stick_button == be->window) {
       redrawStickyButton(True);
     } else if (frame.plate == be->window) {
-      if (windowmenu && windowmenu->isVisible()) windowmenu->hide();
-
       screen->getWorkspace(blackbox_attrib.workspace)->raiseWindow(this);
 
       XAllowEvents(blackbox->getXDisplay(), ReplayPointer, be->time);
@@ -3133,58 +3057,12 @@ void BlackboxWindow::buttonPressEvent(const XButtonEvent *be) {
         }
       }
 
-      if (windowmenu && windowmenu->isVisible()) windowmenu->hide();
-
       screen->getWorkspace(blackbox_attrib.workspace)->raiseWindow(this);
     }
   } else if (be->button == 2 && (be->window != frame.iconify_button) &&
              (be->window != frame.close_button) &&
              (be->window != frame.stick_button)) {
     screen->getWorkspace(blackbox_attrib.workspace)->lowerWindow(this);
-  } else if (windowmenu && be->button == 3 &&
-             (frame.title == be->window || frame.label == be->window ||
-              frame.handle == be->window || frame.window == be->window)) {
-    if (windowmenu->isVisible()) {
-      windowmenu->hide();
-    } else {
-      int mx = be->x_root - windowmenu->getWidth() / 2,
-          my = be->y_root - windowmenu->getHeight() / 2;
-
-      // snap the window menu into a corner/side if necessary
-      int left_edge, right_edge, top_edge, bottom_edge;
-
-      /*
-         the " + (frame.border_w * 2) - 1" bits are to get the proper width
-         and height of the menu, as the sizes returned by it do not include
-         the borders.
-       */
-      left_edge = frame.rect.x();
-      right_edge = frame.rect.right() -
-        (windowmenu->getWidth() + (frame.border_w * 2) - 1);
-      top_edge = client.rect.top() - (frame.border_w + frame.mwm_border_w);
-      bottom_edge = client.rect.bottom() -
-        (windowmenu->getHeight() + (frame.border_w * 2) - 1) +
-        (frame.border_w + frame.mwm_border_w);
-
-      if (mx < left_edge)
-        mx = left_edge;
-      else if (mx > right_edge)
-        mx = right_edge;
-      if (my < top_edge)
-        my = top_edge;
-      else if (my > bottom_edge)
-        my = bottom_edge;
-      
-      if (my + windowmenu->getHeight() > screen->getHeight())
-        my = screen->getHeight() - windowmenu->getHeight() -
-          (screen->getBorderWidth() * 2);
-
-      windowmenu->move(mx, my);
-      windowmenu->show();
-      XRaiseWindow(blackbox->getXDisplay(), windowmenu->getWindowID());
-      XRaiseWindow(blackbox->getXDisplay(),
-                   windowmenu->getSendToMenu()->getWindowID());
-    }
   // mouse wheel up
   } else if (be->button == 4) {
     if ((be->window == frame.label ||
@@ -3276,9 +3154,6 @@ void BlackboxWindow::beginMove(int x_root, int y_root) {
                GrabModeAsync, GrabModeAsync,
                None, blackbox->getMoveCursor(), CurrentTime);
 
-  if (windowmenu && windowmenu->isVisible())
-    windowmenu->hide();
-
   flags.moving = True;
   blackbox->setChangingWindow(this);
 
@@ -3431,25 +3306,6 @@ void BlackboxWindow::doWindowSnapping(int &dx, int &dy) {
       if (*st_it != this) // don't snap to ourself
         rectlist.push_back( (*st_it)->frameRect() );
 
-    // add the toolbar and the slit to the rect list.
-    // (only if they are not hidden)
-    Toolbar *tbar = screen->getToolbar();
-    Slit *slit = screen->getSlit();
-    Rect tbar_rect, slit_rect;
-    unsigned int bwidth = screen->getBorderWidth() * 2;
-
-    if (! (screen->doHideToolbar() || tbar->isHidden())) {
-      tbar_rect.setRect(tbar->getX(), tbar->getY(), tbar->getWidth() + bwidth,
-                        tbar->getHeight() + bwidth);
-      rectlist.push_back(tbar_rect);
-    }
-
-    if (! slit->isHidden()) {
-      slit_rect.setRect(slit->getX(), slit->getY(), slit->getWidth() + bwidth,
-                        slit->getHeight() + bwidth);
-      rectlist.push_back(slit_rect);
-    }
-
     RectList::const_iterator it, end = rectlist.end();
     for (it = rectlist.begin(); it != end; ++it) {
       bool snapped = False;
This page took 0.029789 seconds and 4 git commands to generate.