Show
Ignore:
Timestamp:
08/01/2008 03:44:22 PM (2 years ago)
Author:
dunkfordyce <dunkfordyce@…>
Children:
8cb29f0449b55f9722acde17e3cf24cf1c7e501e
Parents:
4ade186470c310d77434411f4fab27ab8ccfc5a0
git-committer:
dunkfordyce <dunkfordyce@561c22c7-a851-0410-91f3-c76db74392ff> / 2008-08-01T14:44:22Z+0000
Message:

opaque window resizing

git-svn-id:  https://samurai-x.googlecode.com/svn/trunk@15 561c22c7-a851-0410-91f3-c76db74392ff

Location:
samurai-x/samuraix
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • samurai-x/samuraix/client.py

    r4ade18 re5a49d  
    398398        root = xlib.XRootWindow(samuraix.display, self.screen.num) 
    399399 
     400 
    400401        if (xlib.XGrabPointer(samuraix.display,  
    401402                root, 
     
    405406            return  
    406407 
     408        if not xlib.XGrabServer(samuraix.display): 
     409            log.warn('possibly failed grabbing server') 
     410         
     411        gc = xlib.XCreateGC(samuraix.display, self.window, 0, None) 
     412        xlib.XSetForeground(samuraix.display, gc, self.screen.white_pixel) 
     413        xlib.XSetFunction(samuraix.display, gc, xlib.GXxor) 
     414        xlib.XSetSubwindowMode(samuraix.display, gc, xlib.IncludeInferiors) 
     415        #xlib.XSetBackground(samuraix.display, gc, self.screen.white_pixel) 
     416 
    407417        xlib.XWarpPointer(samuraix.display, xlib.None_, self.window, 0, 0, 0, 0, 
    408418            self.geom.width + self.border_width - 1, self.geom.height + self.border_width - 1)    
     
    412422        geom = self.geom.copy() 
    413423 
     424        xlib.XDrawRectangle(samuraix.display, root, gc,  
     425                geom.x, geom.y, geom.width, geom.height) 
     426        xlib.XFlush(samuraix.display) 
     427        xlib.XSync(samuraix.display, 0) 
     428 
     429        ev = xlib.XEvent() 
     430 
    414431        while True: 
    415432 
    416             xlib.XMaskEvent(samuraix.display,  
    417                 MOUSEMASK | xlib.ExposureMask | xlib.SubstructureRedirectMask, 
    418                 byref(ev)) 
     433            xlib.XNextEvent(samuraix.display, byref(ev)) 
     434 
     435            #xlib.XMaskEvent(samuraix.display,  
     436            #    MOUSEMASK | xlib.ExposureMask | xlib.SubstructureRedirectMask, 
     437            #    byref(ev)) 
    419438 
    420439            if ev.type == xlib.ButtonRelease: 
     
    422441                break 
    423442            elif ev.type == xlib.MotionNotify: 
     443                # erase the old box  
     444                xlib.XDrawRectangle(samuraix.display, root, gc,  
     445                        geom.x, geom.y, geom.width, geom.height) 
     446 
    424447                geom.width = max(0, ev.xmotion.x - ocx - 2 * self.border_width + 1) 
    425448                geom.height = max(0, ev.xmotion.y - ocy - 2 * self.border_width + 1) 
    426                 self.resize(geom) 
     449 
     450                xlib.XDrawRectangle(samuraix.display, root, gc,  
     451                        geom.x, geom.y, geom.width, geom.height) 
     452                xlib.XFlush(samuraix.display) 
     453                xlib.XSync(samuraix.display, 0) 
    427454            else: 
    428455                samuraix.app.handle_event(ev) 
    429456 
     457        # erase the box 
     458        xlib.XDrawRectangle(samuraix.display, root, gc,  
     459                geom.x, geom.y, geom.width, geom.height) 
     460        xlib.XFlush(samuraix.display) 
     461        xlib.XSync(samuraix.display, 0) 
     462 
     463        xlib.XUngrabServer(samuraix.display) 
     464        xlib.XFreeGC(samuraix.display, gc) 
     465 
     466        self.resize(geom) 
    430467        self.floating_geom = self.geom.copy() 
    431468        self.resizing = False 
  • samurai-x/samuraix/defaultconfig.py

    rb5c412 re5a49d  
    66from samuraix.userfuncs import * 
    77 
     8default_mod = xlib.Mod4Mask 
    89 
    910config = { 
     
    3233 
    3334            'keys': { 
    34                 (keysymdef.XK_Return, xlib.Mod4Mask):  
     35                (keysymdef.XK_Return, default_mod):  
    3536                    spawn("xterm"), 
    36                 (keysymdef.XK_g, xlib.Mod4Mask): 
     37                (keysymdef.XK_g, default_mod): 
    3738                    spawn("gimp"), 
    3839 
    39                 (keysymdef.XK_F2, xlib.Mod4Mask): 
    40                     spawn("./samurai-runner"), 
     40                (keysymdef.XK_F2, default_mod): 
     41                    spawn("./sx-runner"), 
    4142 
    42                 (keysymdef.XK_Page_Up, xlib.Mod4Mask): 
     43                (keysymdef.XK_Page_Up, default_mod): 
    4344                    spawn("amixer -c 0 set Master 2dB+"), 
    44                 (keysymdef.XK_Page_Down, xlib.Mod4Mask): 
     45                (keysymdef.XK_Page_Down, default_mod): 
    4546                    spawn("amixer -c 0 set Master 2dB-"), 
    46                 (keysymdef.XK_End, xlib.Mod4Mask): 
     47                (keysymdef.XK_End, default_mod): 
    4748                    spawn("amixer -c 0 set Master 0dB+ toggle"), 
    4849                 
    49                 (keysymdef.XK_l, xlib.Mod4Mask): 
     50                (keysymdef.XK_l, default_mod): 
    5051                    spawn("xlock -mode biof"), 
    5152 
    52                 (keysymdef.XK_1, xlib.Mod4Mask):  
     53                (keysymdef.XK_1, default_mod):  
    5354                    screenfunc('set_active_desktop_by_index', 0), 
    54                 (keysymdef.XK_2, xlib.Mod4Mask): 
     55                (keysymdef.XK_2, default_mod): 
    5556                    screenfunc('set_active_desktop_by_index', 1), 
    56                 (keysymdef.XK_3, xlib.Mod4Mask): 
     57                (keysymdef.XK_3, default_mod): 
    5758                    screenfunc('set_active_desktop_by_index', 2), 
    58                 (keysymdef.XK_4, xlib.Mod4Mask): 
     59                (keysymdef.XK_4, default_mod): 
    5960                    screenfunc('set_active_desktop_by_index', 3), 
    60                 (keysymdef.XK_5, xlib.Mod4Mask): 
     61                (keysymdef.XK_5, default_mod): 
    6162                    screenfunc('set_active_desktop_by_index', 4), 
    62                 (keysymdef.XK_6, xlib.Mod4Mask): 
     63                (keysymdef.XK_6, default_mod): 
    6364                    screenfunc('set_active_desktop_by_index', 5), 
    64                 (keysymdef.XK_7, xlib.Mod4Mask): 
     65                (keysymdef.XK_7, default_mod): 
    6566                    screenfunc('set_active_desktop_by_index', 6), 
    66                 (keysymdef.XK_8, xlib.Mod4Mask): 
     67                (keysymdef.XK_8, default_mod): 
    6768                    screenfunc('set_active_desktop_by_index', 7), 
    68                 (keysymdef.XK_9, xlib.Mod4Mask): 
     69                (keysymdef.XK_9, default_mod): 
    6970                    screenfunc('set_active_desktop_by_index', 8), 
    7071 
    71                 (keysymdef.XK_Right, xlib.Mod4Mask): 
     72                (keysymdef.XK_Right, default_mod): 
    7273                    screenfunc('next_desktop'), 
    73                 (keysymdef.XK_Left, xlib.Mod4Mask): 
     74                (keysymdef.XK_Left, default_mod): 
    7475                    screenfunc('prev_desktop'), 
    7576 
    76                 (keysymdef.XK_m, xlib.Mod4Mask): 
     77                (keysymdef.XK_m, default_mod): 
    7778                    focusedwindowfunc('toggle_maximise'),                
    7879            }, 
     
    8687    'client': { 
    8788        'buttons': { 
    88             (1, xlib.Mod4Mask): clientfunc('mousemove'), 
    89             (3, xlib.Mod4Mask): clientfunc('mouseresize'),  
     89            (1, default_mod): clientfunc('mousemove'), 
     90            (3, default_mod): clientfunc('mouseresize'),  
    9091        } 
    9192    },