it's here too, joined at this message

Regards.

--
|      Nicolas Delon --- EPITA student      |
|  e-mail at home: [EMAIL PROTECTED]  |
|     at school: [EMAIL PROTECTED]     |
|  web site: http://www.epita.fr/~delon_n   |
|               GNU/Linux User              |


diff -x Makefile* -cr /goinfre/orig/src/BaseDisplay.cc ./BaseDisplay.cc
*** /goinfre/orig/src/BaseDisplay.cc    Thu Oct  5 21:05:40 2000
--- ./BaseDisplay.cc    Thu Jul 26 18:00:16 2001
***************
*** 367,372 ****
--- 367,374 ----
    cursor.move = XCreateFontCursor(display, XC_fleur);
    cursor.ll_angle = XCreateFontCursor(display, XC_ll_angle);
    cursor.lr_angle = XCreateFontCursor(display, XC_lr_angle);
+   cursor.ul_angle = XCreateFontCursor(display, XC_ul_angle);
+   cursor.ur_angle = XCreateFontCursor(display, XC_ur_angle);
  
    XSetErrorHandler((XErrorHandler) handleXErrors);
  
***************
*** 377,382 ****
--- 379,417 ----
    for (i = 0; i < number_of_screens; i++) {
      ScreenInfo *screeninfo = new ScreenInfo(this, i);
      screenInfoList->insert(screeninfo);
+   }
+   
+   {
+     XModifierKeymap *modmap;
+     static int mask_table[] = {
+       ShiftMask,LockMask,ControlMask,Mod1Mask,
+       Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask
+     };
+     KeyCode num_lock_code = XKeysymToKeycode(display, XK_Num_Lock);
+     KeyCode scroll_lock_code = XKeysymToKeycode(display, XK_Scroll_Lock);
+     KeyCode caps_lock_mode = XKeysymToKeycode(display, XK_Caps_Lock);
+     int cnt;
+     int size;
+     
+     if (num_lock_code && scroll_lock_code && caps_lock_mode) {
+       if ((modmap = XGetModifierMapping(display))) {
+       if (modmap->max_keypermod > 0) {
+         size = (sizeof (mask_table) / sizeof (mask_table[0])) * 
+modmap->max_keypermod;
+         for (cnt = 0; cnt < size; cnt++) {
+           
+           if (num_lock_code == modmap->modifiermap[cnt])
+             NumLockMask = mask_table[cnt / modmap->max_keypermod];
+           
+           if (scroll_lock_code == modmap->modifiermap[cnt])
+             ScrollLockMask = mask_table[cnt / modmap->max_keypermod];
+           
+           if (caps_lock_mode == modmap->modifiermap[cnt])
+             CapsLockMask = mask_table[cnt / modmap->max_keypermod];
+         }
+       }
+       } else
+       XFreeModifiermap(modmap);
+     }
    }
  }
  
diff -x Makefile* -cr /goinfre/orig/src/BaseDisplay.hh ./BaseDisplay.hh
*** /goinfre/orig/src/BaseDisplay.hh    Thu Oct  5 21:05:40 2000
--- ./BaseDisplay.hh    Wed Jul 25 13:07:34 2001
***************
*** 24,29 ****
--- 24,30 ----
  
  #include <X11/Xlib.h>
  #include <X11/Xatom.h>
+ #include <X11/keysym.h>
  
  // forward declaration
  class BaseDisplay;
***************
*** 73,79 ****
  class BaseDisplay {
  private:
    struct cursor {
!     Cursor session, move, ll_angle, lr_angle;
    } cursor;
  
    struct shape {
--- 74,80 ----
  class BaseDisplay {
  private:
    struct cursor {
!     Cursor session, move, ll_angle, lr_angle, ul_angle, ur_angle;
    } cursor;
  
    struct shape {
***************
*** 81,86 ****
--- 82,89 ----
      int event_basep, error_basep;
    } shape;
  
+   int CapsLockMask, ScrollLockMask, NumLockMask;
+ 
    Atom xa_wm_colormap_windows, xa_wm_protocols, xa_wm_state,
      xa_wm_delete_window, xa_wm_take_focus, xa_wm_change_state,
      motif_wm_hints;
***************
*** 138,143 ****
--- 141,150 ----
    BaseDisplay(char *, char * = 0);
    virtual ~BaseDisplay(void);
  
+   inline const int &getCapsLockMask(void) const { return CapsLockMask; }
+   inline const int &getNumLockMask(void) const { return NumLockMask; }
+   inline const int &getScrollLockMask(void) const { return ScrollLockMask; }
+   
    inline const Atom &getWMChangeStateAtom(void) const
      { return xa_wm_change_state; }
    inline const Atom &getWMStateAtom(void) const
***************
*** 280,285 ****
--- 287,296 ----
      { return cursor.ll_angle; }
    inline const Cursor &getLowerRightAngleCursor(void) const
      { return cursor.lr_angle; }
+   inline const Cursor &getUpperLeftAngleCursor(void) const
+     { return cursor.ul_angle; }
+   inline const Cursor &getUpperRightAngleCursor(void) const
+     { return cursor.ur_angle; }
  
    inline Display *getXDisplay(void) { return display; }
  
diff -x Makefile* -cr /goinfre/orig/src/Screen.hh ./Screen.hh
*** /goinfre/orig/src/Screen.hh Mon Jun 19 03:55:33 2000
--- ./Screen.hh Thu Jul 26 17:25:52 2001
***************
*** 118,123 ****
--- 118,124 ----
    Workspace *current_workspace;
    Workspacemenu *workspacemenu;
  
+   int WindowZones;
    unsigned int geom_w, geom_h;
    unsigned long event_mask;
  
***************
*** 251,258 ****
--- 252,262 ----
    { return resource.row_direction; }
    inline const int &getColPlacementDirection(void) const
    { return resource.col_direction; }
+   inline const int &getWindowZones(void) const 
+   { return WindowZones; }
  
    inline void setRootColormapInstalled(Bool r) { root_colormap_installed = r; }
+   inline void saveWindowZones(int n) { WindowZones = n; }
    inline void saveSloppyFocus(Bool s) { resource.sloppy_focus = s; }
    inline void saveAutoRaise(Bool a) { resource.auto_raise = a; }
    inline void saveWorkspaces(int w) { resource.workspaces = w; }
diff -x Makefile* -cr /goinfre/orig/src/Window.cc ./Window.cc
*** /goinfre/orig/src/Window.cc Fri Oct  6 02:01:12 2000
--- ./Window.cc Thu Jul 26 17:18:11 2001
***************
*** 68,73 ****
--- 68,74 ----
                     "BlackboxWindow::BlackboxWindow(): creating 0x%lx\n"),
          w);
  #endif // DEBUG
+   
  
    blackbox = b;
    display = blackbox->getXDisplay();
***************
*** 277,296 ****
    }
  
    associateClientWindow();
! 
!   if (! screen->isSloppyFocus())
!     XGrabButton(display, Button1, 0, frame.plate, True, ButtonPressMask,
!               GrabModeSync, GrabModeSync, None, None);
! 
!   XGrabButton(display, Button1, Mod1Mask, frame.window, True,
!             ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
!             GrabModeAsync, None, blackbox->getMoveCursor());
!   XGrabButton(display, Button2, Mod1Mask, frame.window, True,
!             ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, None);
!   XGrabButton(display, Button3, Mod1Mask, frame.window, True,
!             ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
!             GrabModeAsync, None, blackbox->getLowerRightAngleCursor());
! 
    positionWindows();
    XRaiseWindow(display, frame.plate);
    XMapSubwindows(display, frame.plate);
--- 278,316 ----
    }
  
    associateClientWindow();
!   
!   {
!     int CapsLockMask = blackbox->getCapsLockMask();
!     int NumLockMask = blackbox->getNumLockMask();
!     int ScrollLockMask = blackbox->getScrollLockMask();
!     
!     int mask[] = { 
!       0,
!       CapsLockMask,
!       CapsLockMask | NumLockMask,
!       CapsLockMask | ScrollLockMask,
!       CapsLockMask | NumLockMask | ScrollLockMask,
!       NumLockMask,
!       NumLockMask | ScrollLockMask,
!       ScrollLockMask
!     };
!     unsigned  cnt;
! 
!     for (cnt = 0; cnt < sizeof (mask) / sizeof (mask[0]); cnt++) {
!       if (! screen->isSloppyFocus())
!       XGrabButton(display, Button1, mask[cnt], frame.plate, True, ButtonPressMask,
!                   GrabModeSync, GrabModeSync, None, None);
!       
!       XGrabButton(display, Button1, Mod1Mask | mask[cnt], frame.window, True,
!                 ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
!                 GrabModeAsync, None, blackbox->getMoveCursor());
!       XGrabButton(display, Button2, Mod1Mask | mask[cnt], frame.window, True,
!                 ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, None);
!       XGrabButton(display, Button3, Mod1Mask | mask[cnt], frame.window, True,
!                 ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
!                 GrabModeAsync, None, None);//blackbox->getLowerRightAngleCursor());
!     }
!   }
    positionWindows();
    XRaiseWindow(display, frame.plate);
    XMapSubwindows(display, frame.plate);
***************
*** 2408,2419 ****
  
  
  void BlackboxWindow::buttonPressEvent(XButtonEvent *be) {
    blackbox->grab();
    if (! validateClient()) return;
! 
    if (frame.maximize_button == be->window) {
      redrawMaximizeButton(True);
!   } else if (be->button == 1 || (be->button == 3 && be->state == Mod1Mask)) {
      if ((! focused) && (! screen->isSloppyFocus()))
        setInputFocus();
  
--- 2428,2441 ----
  
  
  void BlackboxWindow::buttonPressEvent(XButtonEvent *be) {
+   
    blackbox->grab();
    if (! validateClient()) return;
!   
    if (frame.maximize_button == be->window) {
      redrawMaximizeButton(True);
!   } else if (be->button == 1 || (be->button == 3 && be->state & Mod1Mask)) {
!     
      if ((! focused) && (! screen->isSloppyFocus()))
        setInputFocus();
  
***************
*** 2437,2446 ****
              (be->state & ControlMask)) {
          lastButtonPressTime = 0;
          shade();
!       } else
!         lastButtonPressTime = be->time;
        }
! 
        frame.grab_x = be->x_root - frame.x - screen->getBorderWidth();
        frame.grab_y = be->y_root - frame.y - screen->getBorderWidth();
  
--- 2459,2479 ----
              (be->state & ControlMask)) {
          lastButtonPressTime = 0;
          shade();
!       } 
!       } else {
!       if (frame.window != be->window)
!         resize_zone = ZoneBottom |
!           ((frame.left_grip == be->window) ? ZoneLeft : ZoneRight);
!       else
!         resize_zone = 
!           ((be->y <= (signed) getClientHeight() / 2 && screen->getWindowZones() == 
4) 
!            ? ZoneTop : ZoneBottom) |
!           ((be->x <= (signed) getClientWidth() / 2 && screen->getWindowZones() >= 2)
!            ? ZoneLeft : ZoneRight);
        }
!       
!       lastButtonPressTime = be->time;
!       
        frame.grab_x = be->x_root - frame.x - screen->getBorderWidth();
        frame.grab_y = be->y_root - frame.y - screen->getBorderWidth();
  
***************
*** 2455,2461 ****
             (frame.title == be->window || frame.label == be->window ||
              frame.handle == be->window || frame.window == be->window)) {
      int mx = 0, my = 0;
! 
      if (frame.title == be->window || frame.label == be->window) {
        mx = be->x_root - (windowmenu->getWidth() / 2);
        my = frame.y + frame.title_h;
--- 2488,2494 ----
             (frame.title == be->window || frame.label == be->window ||
              frame.handle == be->window || frame.window == be->window)) {
      int mx = 0, my = 0;
!     
      if (frame.title == be->window || frame.label == be->window) {
        mx = be->x_root - (windowmenu->getWidth() / 2);
        my = frame.y + frame.title_h;
***************
*** 2492,2502 ****
        } else
        windowmenu->hide();
    }
- 
    blackbox->ungrab();
  }
  
- 
  void BlackboxWindow::buttonReleaseEvent(XButtonEvent *re) {
    blackbox->grab();
    if (! validateClient()) return;
--- 2525,2533 ----
***************
*** 2558,2564 ****
        close();
      redrawCloseButton(False);
    }
! 
    blackbox->ungrab();
  }
  
--- 2589,2595 ----
        close();
      redrawCloseButton(False);
    }
!   resize_zone = 0;
    blackbox->ungrab();
  }
  
***************
*** 2650,2673 ****
    } else if (functions.resize &&
             (((me->state & Button1Mask) && (me->window == frame.right_grip ||
                                             me->window == frame.left_grip)) ||
!             (me->state == (Mod1Mask | Button3Mask) &&
                                             me->window == frame.window))) {
!     Bool left = (me->window == frame.left_grip);
  
      if (! resizing) {
        XGrabPointer(display, me->window, False, ButtonMotionMask |
                     ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None,
!                    ((left) ? blackbox->getLowerLeftAngleCursor() :
!                              blackbox->getLowerRightAngleCursor()),
!                    CurrentTime);
  
        resizing = True;
  
        blackbox->grab();
  
        int gx, gy;
!       frame.grab_x = me->x - screen->getBorderWidth();
!       frame.grab_y = me->y - screen->getBorderWidth2x();
        frame.resize_x = frame.x;
        frame.resize_y = frame.y;
        frame.resize_w = frame.width + screen->getBorderWidth2x();
--- 2681,2721 ----
    } else if (functions.resize &&
             (((me->state & Button1Mask) && (me->window == frame.right_grip ||
                                             me->window == frame.left_grip)) ||
!             (me->state & (Mod1Mask | Button3Mask) &&
                                             me->window == frame.window))) {
!     Bool left = resize_zone & ZoneLeft;
  
      if (! resizing) {
+       Cursor cursor;
+       
+       cursor = (resize_zone & ZoneTop) ? 
+       ((resize_zone & ZoneLeft) ? 
+        blackbox->getUpperLeftAngleCursor() :
+        blackbox->getUpperRightAngleCursor()) :
+       ((resize_zone & ZoneLeft) ?
+        blackbox->getLowerLeftAngleCursor() :
+        blackbox->getLowerRightAngleCursor());
+       
        XGrabPointer(display, me->window, False, ButtonMotionMask |
                     ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None,
!                    cursor, CurrentTime);
  
        resizing = True;
  
        blackbox->grab();
  
        int gx, gy;
! 
!       if (resize_zone & ZoneRight)
!       frame.grab_x = me->x - screen->getBorderWidth();
!       else
!       frame.grab_x = me->x + screen->getBorderWidth();
!       
!       if (resize_zone & ZoneTop)
!       frame.grab_y = me->y + screen->getBorderWidth2x();
!       else
!       frame.grab_y = me->y - screen->getBorderWidth2x();
!       
        frame.resize_x = frame.x;
        frame.resize_y = frame.y;
        frame.resize_w = frame.width + screen->getBorderWidth2x();
***************
*** 2690,2711 ****
  
        int gx, gy;
  
!       frame.resize_h = frame.height + (me->y - frame.grab_y);
        if (frame.resize_h < 1) frame.resize_h = 1;
  
        if (left) {
!         frame.resize_x = me->x_root - frame.grab_x;
          if (frame.resize_x > (signed) (frame.x + frame.width))
            frame.resize_x = frame.resize_x + frame.width - 1;
  
          left_fixsize(&gx, &gy);
        } else {
        frame.resize_w = frame.width + (me->x - frame.grab_x);
        if (frame.resize_w < 1) frame.resize_w = 1;
! 
        right_fixsize(&gx, &gy);
        }
! 
        XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(),
                     frame.resize_x, frame.resize_y,
                     frame.resize_w, frame.resize_h);
--- 2738,2764 ----
  
        int gx, gy;
  
!       if (resize_zone & ZoneTop)
!       frame.resize_h = frame.height - (me->y - frame.grab_y);
!       else
!       frame.resize_h = frame.height + (me->y - frame.grab_y);
!       
        if (frame.resize_h < 1) frame.resize_h = 1;
  
        if (left) {
!         frame.resize_x =  me->x_root - frame.grab_x;
          if (frame.resize_x > (signed) (frame.x + frame.width))
            frame.resize_x = frame.resize_x + frame.width - 1;
  
          left_fixsize(&gx, &gy);
        } else {
        frame.resize_w = frame.width + (me->x - frame.grab_x);
+       
        if (frame.resize_w < 1) frame.resize_w = 1;
!       
        right_fixsize(&gx, &gy);
        }
!       
        XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(),
                     frame.resize_x, frame.resize_y,
                     frame.resize_w, frame.resize_h);
***************
*** 2953,2965 ****
  
    frame.resize_w = dx + (frame.mwm_border_w * 2) + screen->getBorderWidth2x();
    frame.resize_h = dy + frame.y_border + frame.handle_h +
!                    (frame.mwm_border_w * 2) +  (screen->getBorderWidth() * 3);
  }
  
  
  void BlackboxWindow::left_fixsize(int *gx, int *gy) {
    // calculate the size of the client window and conform it to the
    // size specified by the size hints of the client window...
    int dx = frame.x + frame.width - frame.resize_x - client.base_width -
      (frame.mwm_border_w * 2);
    int dy = frame.resize_h - frame.y_border - client.base_height -
--- 3006,3023 ----
  
    frame.resize_w = dx + (frame.mwm_border_w * 2) + screen->getBorderWidth2x();
    frame.resize_h = dy + frame.y_border + frame.handle_h +
!     (frame.mwm_border_w * 2) +  (screen->getBorderWidth() * 3);
!   if (resize_zone & ZoneTop)
!     frame.resize_y = frame.y + frame.height - frame.resize_h +
!       screen->getBorderWidth2x();
  }
  
  
  void BlackboxWindow::left_fixsize(int *gx, int *gy) {
    // calculate the size of the client window and conform it to the
    // size specified by the size hints of the client window...
+   
+ 
    int dx = frame.x + frame.width - frame.resize_x - client.base_width -
      (frame.mwm_border_w * 2);
    int dy = frame.resize_h - frame.y_border - client.base_height -
***************
*** 2979,2987 ****
    dx = (dx * client.width_inc) + client.base_width;
    dy = (dy * client.height_inc) + client.base_height;
  
    frame.resize_w = dx + (frame.mwm_border_w * 2) + screen->getBorderWidth2x();
    frame.resize_x = frame.x + frame.width - frame.resize_w +
!                    screen->getBorderWidth2x();
!   frame.resize_h = dy + frame.y_border + frame.handle_h +
!                    (frame.mwm_border_w * 2) + (screen->getBorderWidth() * 3);
  }
--- 3037,3048 ----
    dx = (dx * client.width_inc) + client.base_width;
    dy = (dy * client.height_inc) + client.base_height;
  
+   frame.resize_h = dy + frame.y_border + frame.handle_h +
+     (frame.mwm_border_w * 2) + (screen->getBorderWidth() * 3);
    frame.resize_w = dx + (frame.mwm_border_w * 2) + screen->getBorderWidth2x();
    frame.resize_x = frame.x + frame.width - frame.resize_w +
!     screen->getBorderWidth2x();
!   if (resize_zone & ZoneTop)
!     frame.resize_y = frame.y + frame.height - frame.resize_h +
!       screen->getBorderWidth2x();
  }
diff -x Makefile* -cr /goinfre/orig/src/Window.hh ./Window.hh
*** /goinfre/orig/src/Window.hh Mon Jun 19 22:42:44 2000
--- ./Window.hh Wed Jul 25 15:10:07 2001
***************
*** 53,58 ****
--- 53,63 ----
  #define MwmDecorIconify       (1l << 5)
  #define MwmDecorMaximize      (1l << 6)
  
+ #define       ZoneTop                 (1 << 0)
+ #define       ZoneBottom              (1 << 1)
+ #define       ZoneRight               (1 << 2)
+ #define       ZoneLeft                        (1 << 3)
+ 
  // this structure only contains 3 elements... the Motif 2.0 structure contains
  // 5... we only need the first 3... so that is all we will define
  typedef struct MwmHints {
***************
*** 66,72 ****
  private:
    BImageControl *image_ctrl;
    Blackbox *blackbox;
!   Bool moving, resizing, shaded, maximized, visible, iconic, transient,
      focused, stuck, modal, send_focus_message, managed;
    BScreen *screen;
    BTimer *timer;
--- 71,78 ----
  private:
    BImageControl *image_ctrl;
    Blackbox *blackbox;
!   Bool moving, resizing, shaded, maximized, 
!     visible, iconic, transient,
      focused, stuck, modal, send_focus_message, managed;
    BScreen *screen;
    BTimer *timer;
***************
*** 78,83 ****
--- 84,90 ----
  
    int focus_mode, window_number, workspace_number;
    unsigned long current_state;
+   int resize_zone;
  
    struct _client {
      BlackboxWindow *transient_for,  // which window are we a transient for?
Only in .: bb.patch
diff -x Makefile* -cr /goinfre/orig/src/blackbox.cc ./blackbox.cc
*** /goinfre/orig/src/blackbox.cc       Sun Jun 25 05:56:48 2000
--- ./blackbox.cc       Thu Jul 26 17:24:55 2001
***************
*** 147,153 ****
    : BaseDisplay(m_argv[0], dpy_name)
  {
    grab();
! 
    if (! XSupportsLocale())
      fprintf(stderr, "X server does not support locale\n");
  
--- 147,153 ----
    : BaseDisplay(m_argv[0], dpy_name)
  {
    grab();
!   
    if (! XSupportsLocale())
      fprintf(stderr, "X server does not support locale\n");
  
***************
*** 274,280 ****
    case ButtonPress:
      {
        last_time = e->xbutton.time;
! 
        BlackboxWindow *win = (BlackboxWindow *) 0;
        Basemenu *menu = (Basemenu *) 0;
  
--- 274,280 ----
    case ButtonPress:
      {
        last_time = e->xbutton.time;
!       
        BlackboxWindow *win = (BlackboxWindow *) 0;
        Basemenu *menu = (Basemenu *) 0;
  
***************
*** 1640,1653 ****
        screen->saveOpaqueMove(False);
    } else
      screen->saveOpaqueMove(False);
  
    XrmDestroyDatabase(database);
  }
  
- 
  void Blackbox::reload_rc(void) {
    load_rc();
!   reconfigure();
  }
  
  
--- 1640,1664 ----
        screen->saveOpaqueMove(False);
    } else
      screen->saveOpaqueMove(False);
+   
+   sprintf(name_lookup, "session.screen%d.windowZones", screen_number);
+   sprintf(class_lookup, "Session.Screen%d.WindowZones", screen_number);
+  
+   if (XrmGetResource(database, name_lookup, class_lookup, &value_type, &value)) {
+     int i = atoi(value.addr);
+     
+     screen->saveWindowZones((i == 1 || i == 2 || i == 4) ? i : 4);
+   }
+   else
+     screen->saveWindowZones(4);
  
    XrmDestroyDatabase(database);
+   
  }
  
  void Blackbox::reload_rc(void) {
    load_rc();
!   real_reconfigure();
  }
  
  

Reply via email to