]> Dogcows Code - chaz/openbox/blobdiff - src/Window.cc
better setting of atoms. plugged memory leak.
[chaz/openbox] / src / Window.cc
index fe13f4c1771fa05e37502b9dc8dfc51f6402e1d2..80f201ad36a34a059f1685c11448db35bf523fbf 100644 (file)
@@ -261,16 +261,16 @@ OpenboxWindow::OpenboxWindow(Openbox &o, Window w, BScreen *s) : openbox(o) {
 
   if (! screen->sloppyFocus())
     openbox.grabButton(Button1, 0, frame.plate, True, ButtonPressMask,
-        GrabModeSync, GrabModeSync, None, None);
+        GrabModeSync, GrabModeSync, frame.plate, None);
 
   openbox.grabButton(Button1, Mod1Mask, frame.window, True,
       ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
-      GrabModeAsync, None, openbox.getMoveCursor());
+      GrabModeAsync, frame.window, openbox.getMoveCursor());
   openbox.grabButton(Button2, Mod1Mask, frame.window, True,
-      ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, None);
+      ButtonReleaseMask, GrabModeAsync, GrabModeAsync, frame.window, None);
   openbox.grabButton(Button3, Mod1Mask, frame.window, True,
       ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
-      GrabModeAsync, None, None);
+      GrabModeAsync, frame.window, None);
 
   positionWindows();
   XRaiseWindow(display, frame.plate);
@@ -721,7 +721,7 @@ void OpenboxWindow::createMaximizeButton(void) {
 }
 
 
-void OpenboxWindow::positionButtons(Bool redecorate_label) {
+void OpenboxWindow::positionButtons() {
   const char *format = openbox.getTitleBarLayout();
   const unsigned int bw = frame.bevel_w + 1;
   const unsigned int by = frame.bevel_w + 1;
@@ -785,23 +785,22 @@ void OpenboxWindow::positionButtons(Bool redecorate_label) {
     }
   }
 
-  if (!hasclose) {
-      openbox.removeWindowSearch(frame.close_button);
-      XDestroyWindow(display, frame.close_button);
-      frame.close_button = None;
+  if (!hasclose && frame.close_button) {
+    openbox.removeWindowSearch(frame.close_button);
+    XDestroyWindow(display, frame.close_button);
+    frame.close_button = None;
   }
-  if (!hasiconify) {
-      openbox.removeWindowSearch(frame.iconify_button);
-      XDestroyWindow(display, frame.iconify_button);
-      frame.iconify_button = None;
+  if (!hasiconify && frame.iconify_button) {
+    openbox.removeWindowSearch(frame.iconify_button);
+    XDestroyWindow(display, frame.iconify_button);
+    frame.iconify_button = None;
   }
-  if (!hasmaximize) {
-      openbox.removeWindowSearch(frame.maximize_button);
-      XDestroyWindow(display, frame.maximize_button);                 
-      frame.maximize_button = None;
+  if (!hasmaximize && frame.iconify_button) {
+    openbox.removeWindowSearch(frame.maximize_button);
+    XDestroyWindow(display, frame.maximize_button);                 
+    frame.maximize_button = None;
   }
-  if (redecorate_label)
-    decorateLabel();
+
   redrawLabel();
   redrawAllButtons();
 }
@@ -1302,10 +1301,9 @@ void OpenboxWindow::configure(int dx, int dy,
 
     XMoveWindow(display, frame.window, frame.x, frame.y);
 
+    setFocusFlag(flags.focused);
     positionWindows();
     decorate();
-    setFocusFlag(flags.focused);
-    redrawAllButtons();
   } else {
     frame.x = dx;
     frame.y = dy;
@@ -1534,7 +1532,7 @@ void OpenboxWindow::maximize(unsigned int button) {
     openbox_attrib.premax_x = openbox_attrib.premax_y = 0;
     openbox_attrib.premax_w = openbox_attrib.premax_h = 0;
 
-    redrawAllButtons();
+    redrawMaximizeButton(flags.maximized);
     setState(current_state);
     return;
   }
@@ -1608,7 +1606,7 @@ void OpenboxWindow::maximize(unsigned int button) {
 
   configure(dx, dy, dw, dh);
   screen->getWorkspace(workspace_number)->raiseWindow(this);
-  redrawAllButtons();
+  redrawMaximizeButton(flags.maximized);
   setState(current_state);
 }
 
@@ -2241,12 +2239,8 @@ void OpenboxWindow::mapNotifyEvent(XMapEvent *ne) {
     openbox.grab();
     if (! validateClient()) return;
 
-    if (decorations.titlebar) positionButtons();
-
     setState(NormalState);
 
-    redrawAllButtons();
-
     if (flags.transient || screen->focusNew())
       setInputFocus();
     else
@@ -2410,7 +2404,10 @@ void OpenboxWindow::propertyNotifyEvent(Atom atom) {
 
       if (decorations.close && (! frame.close_button)) {
         createCloseButton();
-        if (decorations.titlebar) positionButtons(True);
+        if (decorations.titlebar) {
+          positionButtons();
+          decorateLabel();
+        }
         if (windowmenu) windowmenu->reconfigure();
       }
     }
This page took 0.026081 seconds and 4 git commands to generate.