Re: Re: Starting from scratch... (try 3)

cerbie <ernie-P8xLOxVu+KW1Z/[email protected]>
Newsgroups gmane.comp.windows.shells.litestep
Message-ID <[email protected]>
Weeble wrote:
> (snip)
> The only thing moving in my example is a label. I've gotten a very
> basic (and ugly) version working:
>
> (snip)
>
> The red box represents your currently active desktop. You drag it left
> and right to select a desktop, and it switches to that desktop when
> you do. Ideally the red box would be lined up above/below your VWM and
> not be so huge, nor so red or boxy. ;) The only thing that's missing
> right now is updating the position of the red box when you switch
> desktop any other way (e.g. right-clicking on the VWM, hotkeys, etc.).
> I could put in a VWMOnSwitchTo event and use !labelmove, but then I'd
> create a horrible circle - the !labelmove would trigger
> vwmCursorOnMove, which would call !vwmdesk and trigger VWMOnSwitchTo,
> which would call !labelmove...

The basic problem there is locking the label's moving out from causing 
another bang. It can be done just in xLabel, BTW, but it will be far 
from easily readable (but in case you really need to, xLabel is just 
that powerful by itself).

It could also be done by tracking the cursor rather than labels, but 
that gets even more modules involved for what would be basically no gain 
just for this.

So, there needs to be state kept track of, for the easiest 
implementation. Using click down and click up, this can be done with 
ease. The focus lost event takes care of nasty dialogs and things 
stealing focus.

With the following added (partly just to make it easier to check on):

vwmX $vwmCursorX$
vwmY 0
vwmDesksX 5
vwmDesksY 1
vwmWidth $vwmCursorWidth*vwmDesksX$
vwmHeight $vwmCursorHeight$
vwmOnSwitchTo !ParseEvars !labelmove vwmCursor 
%#vwmCursorX+(^@dc^*32)-32%# $vwmCursorY$

...and the vwmCursor config changed to:

vwmCursorOnLeftClickDown !vwmCursor down
vwmCursorOnMove !vwmCursor move
vwmCursorOnLeftClickUp !vwmCursor up
vwmCursorOnFocusLost !vwmCursor up

...and in another file loaded by *LuaFile, using LSLua:

vwmcursordown = false

bang_vwmcursor = function (a)
  if a == 'down' then
      vwmcursordown = true
  elseif a == 'up' then
      vwmcursordown = false
  elseif vwmcursordown then
  -- assumes 'move', and then only works if vwmcursordown is not nil or 
false
      lslua.exec ('!vwmdesk '..math.floor ( 
(evar.vwmCursorCurrentX-evar.vwmCursorX+32) / 32 ) )
      -- same as !ParseEvars !vwmdesk 
%#(vwmCursorCurrentX-vwmCursorX+32)/32%#
  end
end

...it will not have any trouble, is still very close to your posted config.

-cerbie



---------------------------------------------------------------------
    Can't Unsubscribe? Check http://desktopian.org/listunsub.html
        LS List Homepage: http://wuzzle.org/list/litestep.php
            Get the LS FAQ: http://lsfaq.shellfront.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.