AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

real expose clone
Goto page 1, 2, 3 ... 14, 15, 16  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
holomind



Joined: 11 Mar 2006
Posts: 297
Location: Munich, Germany

PostPosted: Sun Oct 01, 2006 12:16 am    Post subject: real expose clone Reply with quote



to see/edit the latest version in wiki click here:
http://www.autohotkey.com/wiki/index.php?title=Workspace%3AExpose_Clone

as suggested by majkinetor, i combined some of my scripts and built a real expose clone, which shows all your windows in miniature and if you click on it it activates this window. compared to the other exposescript here, the windows are not moved or resized, but the window is "zoomed".
like other expose clones this also supports fancy animation, or better fade_in and fade_out. (animation would be possible but its to complicated for me now). you can configure this script in the "read_config" function. (transparency and speed of fade, simply set fade_steps to 1 to turn it off).

i tried to keep the script short, but its the nature of this application that it gets a bit longer. i didnt reuse the other expose script, as i wanted to figure it out myself but borrowed one or two ideas to make it shorter.

you could even have livepreviews if you call "draw_thumbnails:" in a timer function, but for me its enough to draw it only once. (less cpu)

use mbutton or win-tab to activate it. (pressing the same key while expose is running will end it and do no modification to any window)
activate the window by clicking on the replica.

important: if you miss windows then change min_w and min_h or change the function is_excluded_win()

download: expose.ahk

Version 0.1: initial version
Version 0.2: changed configs and added strech for small windows
Version 0.3: bugfix for scalethumbs, now correct
Version 0.4: optimized layout one row less if possible
Version 0.5: added live-repaint, to prevent hidden windows (cmd.exe)
Version 0.6: added sorting of task_ids suggested by lazlo, +sleep0 , repainttime now 2secs
Version 0.7: some versions in this thread, thanks for contribution.
Version 0.8: lazlos optimization for gui_destroy order
Version 0.9: lazlos latest Posted: Thu Oct 05, 2006 4:34 pm
Version 0.91: minor change strechblt mode 3
Version 0.92: lazlos optimization for refresh etc.
Version 0.93: on click zoom-out effect added (holomind)
Version 0.94: animation now zooms exactly to clicked window (small change in winactivate(id) as WinMove forces refresh of window.)
Version 0.95: RC1 Wink Superb Animation with Tripple Framebuffer, like Butter Wink Addictive
Version 0.96: correct taskbar detection, optimized transition from real to animation (delay gui show)
Version 0.97: bugfix, detectscreen hat top and left swapped now ok
Version 0.98: bugfix for offset in bitblt, + optimization for backbuffer clearing if number of wins changes. backup 0.98 in wiki
Version 1.00: now in wiki and speed improvements, backup 1.00 in wiki
Version 1.01: added desktopimage, code read more readable, max zoom backup 1.01 in wiki

... from Version 1.0 on we will work in wiki and copy stable versions into forum Wink
Roadplan for Version 1.0 until version 2.0
* agree on a codestyle for all collaborators (we are near already)
(ok) work in realtime in wiki, make bugfixes directly and inform others with forum, so everybody always changes/works on latest version.
* make a small featurelist and who wants to do it, so we dont do things twice (majkinetor proposed a similar list already)
(ok) new feature: rewrite DLLcalls and use #include GDI.ahk (from this thread)
* compact code to satisfy lazlos short style
(ok) rename some variablenames to make it easier to understand
* rewrite functions to enable pluginsystem of majkinetor (and lazlo)
* new feature: config .ini file
* now we can start building .exe as downloadables
* new feature: config gui (lower prio if we have config.ini)
* new feature: fade transition between last animate_out and hide gui
(ok) new feature: enable background image (with offset correction for taskbar)
* new feature: mirror window position of not-maximized windows in thumbposition
* add lots of features/bugfixes from user-feedback
* make a big 2.0 release party Wink

Code:
; v1.01 -- expose.ahk - Thumbnails of windows over the working area

OnExit handle_exit
#SingleInstance Force
#NoEnv
SetBatchLines -1
SetWinDelay 0               ; larger values also fail under heavy load, changing windows
Process Priority,,Above Normal
CoordMode Mouse, Relative

Main:
  Gosub, Read_Keymapping
  Gosub, Read_Config
  Gosub, Detect_Screensize
  Gosub, Create_Gui
  Gosub, Create_Buffers
  ; wait for key/mouse
Return

Read_Keymapping:
  Hotkey, #TAB    ,  Window_Choose
  Hotkey, MButton ,  Window_Choose
  Hotkey, IfWinActive , »Expose«
  Hotkey, #TAB    ,  Window_Activate
  Hotkey, IfWinActive , »Expose«
  Hotkey, MButton ,  Window_Activate
  Hotkey, IfWinActive , »Expose«
  Hotkey, LButton ,  Window_Activate
  Hotkey, IfWinActive , »Expose«
  Hotkey, Esc     ,  hide_gui
  Hotkey, +MButton , handle_exit ; panik-key
Return

Read_Config:
  min_w                = 110  ; min width of windows to be shown
  min_h                = 110  ; min height of windows to be shown (hides taskbar etc)
  scale_thumb_space    = 1    ; scale thumbnails to best fit to box?
  live_redraw          = 1    ; 1/0 = Yes/No
  time_gap             = 50   ; ms, time left for others after each thumbnail draw
  thumb_border          = 1   ; 1 for gap between thumbnail  s
  animate_in_delay     = 5
  animate_in_steps       = 5
  animate_out_delay    = 5
  animate_out_steps    = 5
  show_taskbar          = 1
  ;fade_in_steps       = 5
  ;fade_in_delay       = 5
  ;fade_out_steps      = 5
  ;fade_out_delay      = 50
  quality_low          = 3 ; allowed: 1 (terrible) , 3 (accepatable) 4 (good = slow)
  quality_high         = 4 ; allowed: 1 (terrible) , 3 (accepatable) 4 (good = slow)
  BackGroundColor      = 004E98
  count := 0
Return

Window_Hidden() {
   global
   Return w < min_w or h < min_h or title ="»Expose«" or title =""
}

Detect_ScreenSize:
  Th=0
  Tw=0
  Ty=0
  Tx=0
  if show_taskbar
   WinGetPos,Tx,Ty,Tw,Th,ahk_class Shell_TrayWnd,,,
  WorkArea_Top    :=      ( Tw > Th  and  Tx = 0  and  Ty = 0) * Th
  WorkArea_Left   :=      ( Tw < Th  and  Tx = 0  and  Ty = 0) * Tw
  WorkArea_Height := A_ScreenHeight - ( Tw > Th  ) * Th
  WorkArea_Width  := A_ScreenWidth  - ( Tw < Th  ) * Tw
Return

Create_Gui:
  Gui +AlwaysOnTop -Caption  +Toolwindow +Owner +LastFound
  ;Gui Color, %BackGroundColor%
  Gui Show, Hide  w%WorkArea_Width% h%WorkArea_Height% x%WorkArea_Left% y%WorkArea_Top%, »Expose«
  ;Gui, Add, Pic, x0 y0 w%WorkArea_Width% h%WorkArea_Height%, c:\test.bmp
  DetectHiddenWindows ON
  WinGet Expose_ID , ID, »Expose«
  WinGet Desktop_ID, ID, Program Manager
  DetectHiddenWindows OFF
Return

Create_Buffers:
  hdc_frontbuffer  := GetDC( Expose_ID )

  hdc_printwindow := CreateCompatibleDC(    hdc_frontbuffer)
  hbm_printwindow := CreateCompatibleBitmap(hdc_frontbuffer,WorkArea_Width,WorkArea_Height)
  hbm_old         := SelectObject(          hdc_printwindow,hbm_printwindow)

  hdc_thumbnails  := CreateCompatibleDC(    hdc_frontbuffer)
  hbm_thumbnails  := CreateCompatibleBitmap(hdc_frontbuffer,WorkArea_Width,WorkArea_Height)
  hbm_old         := SelectObject(          hdc_thumbnails,hbm_thumbnails)

  hdc_backbuffer  := CreateCompatibleDC(    hdc_frontbuffer)
  hbm_backbuffer  := CreateCompatibleBitmap(hdc_frontbuffer,WorkArea_Width,WorkArea_Height)
  hbm_old         := SelectObject(          hdc_backbuffer,hbm_backbuffer)

  hdc_desktop     := CreateCompatibleDC(    hdc_frontbuffer)
  hbm_desktop     := CreateCompatibleBitmap(hdc_frontbuffer,WorkArea_Width,WorkArea_Height)
  hbm_old         := SelectObject(          hdc_desktop,hbm_desktop)

  Gui Show
  PaintDesktop( hdc_frontbuffer ) ; 0=window, 1=Child(no toolbars)
  BitBlt(hdc_desktop     , 0, 0, WorkArea_Width, WorkArea_Height
      ,  hdc_frontbuffer , 0, 0 ,0xCC0020) ; SRCCOPY
  BitBlt(hdc_thumbnails  , 0, 0, WorkArea_Width, WorkArea_Height
      ,  hdc_frontbuffer , 0, 0 ,0xCC0020) ; SRCCOPY
  Gui Hide

Return

Window_Choose:
   WinGet ActiveID, ID, A
   SetTimer Window_Choose_Thread, 0       ; new thread to make thumbnail draws interruptible
Return
Window_Choose_Thread:
   Stop_Drawing  =
   yield         := time_gap        ; yield time to other tasks after each thumbnail drawn
   SetTimer Window_Choose_Thread, OFF     ; run once
   GoSub Window_Info           ; list window IDs, sizes, etc.
   Gosub Animate_In
   GoSub Draw_Thumbnails
Return

Window_Activate:
   Stop_Drawing = 1
   MouseGetPos X, Y
   pos := 1 + X*cols//WorkArea_Width + Y*rows//WorkArea_Height * cols 
   task_id := task_ids_%pos%
   If (pos <= num_win and X >= 0 and X <= WorkArea_Width and Y >= 0 and Y <= WorkArea_Height)
   {
      Gosub Animate_Out
         WinActivate(task_id)                 ; activate selected window
      Gosub fade_out
   }
Gui_Hide()
Return

WinActivate(ID) {
   WinGet ,ActiveID2, ID, A
   if ActiveID2 <> ID
       WinActivate ahk_id %ID%
}

Window_Info:
   WinGet ids, list,,,Program Manager      ; all active windows-tasks (processes)
   task_info =
   num_win = 0
   Loop %ids% {
      task_id := ids%A_Index%              ; id of this window
      WinGetClass class, ahk_id %task_id%
      WinGetTitle title, ahk_id %task_id%
      WinGetPos,,, w, h, ahk_id %task_id%
      If Window_Hidden()                 ; small windows not shown (e.g. taskbar)
         Continue
      num_win++
      task_info := task_info class "|" ids%A_Index% "|" w "|" h ","
   }
   StringTrimRight task_info, task_info, 1
   Sort task_info, D,                      ; keep positions of thumbnails
   cols := ceil(sqrt(num_win))
   rows := ceil(sqrt(num_win))
   If (cols*(rows-1) >= num_win)           ; minimize table size
       rows--
   thumb_w := WorkArea_Width  // cols
   thumb_h := WorkArea_Height // rows
   ratio_of_screen := WorkArea_Width / WorkArea_Height * rows / cols
   Loop Parse, task_info, `,               ; task_info has been set up in get_wins()
   {
      StringSplit z, A_LoopField, |        ; separate ID, w, h
      task_ids_%A_Index% := z2             ; needed for activation
      if ( z2 = ActiveID )
      pos = %A_Index%
     w%A_Index% := z3                     ; w
      h%A_Index% := z4                     ; h
      ratio_of_win := z3 / z4              ; w/h
      If ( scale_thumb_space  )  {
         If (ratio_of_win < ratio_of_screen) { ; tall window
            thumb_h%A_Index% := thumb_h - thumb_border
            thumb_w%A_Index% := Floor(thumb_w * ratio_of_win / ratio_of_screen) - thumb_border
         } Else {                              ; wide window
            thumb_w%A_Index% := thumb_w - thumb_border
            thumb_h%A_Index% := Floor(thumb_h * ratio_of_screen / ratio_of_win) - thumb_border
         }
      } Else {
         thumb_w%A_Index% := z3//cols - 2*thumb_border
         thumb_h%A_Index% := z4//cols - 2*thumb_border  ; cols >= rows, keep aspect ratio of window
      }
     if ( thumb_w%A_Index% > w%A_Index% or thumb_h%A_Index% > h%A_Index% )
     {
        thumb_w%A_Index% := w%A_Index%
         thumb_h%A_Index% := h%A_Index%
      }
   }
Return

Draw_Thumbnails:
    If Stop_Drawing
           Return

   WinGet ids_count, list,,,Program Manager      ; all active windows-tasks (processes)
     SetStretchBltMode(hdc_thumbnails,quality_high) ; 3: Lower quality at 1st draw
   
   if ( old_ids_count <> ids_count )
      gosub Window_Info   ; detect if windows were added in expose mode
   
   ; layout changed full refresh (start with empty desktop)
   if ( cols <> old_cols or rows <> old_rows)
       BitBlt( hdc_frontbuffer, 0, 0, WorkArea_Width, WorkArea_Height
           , hdc_desktop, 0, 0 , 0xCC0020) ; SRCCOPY
   
   ; clear "now empty" places , only needed when less, more are filled automatically
   gaps := old_num_win - num_win
    if ( gaps )
   {
     loop %gaps%
     {
        a_index2 := num_win + gaps
       pos_x := thumb_w * Mod(A_Index2-1,cols)
       pos_y := thumb_h * ((A_Index2-1)//cols)
 
       BitBlt( hdc_thumbnails, pos_x, pos_y, thumb_w, thumb_h
              , hdc_desktop,    pos_x, pos_y ,0xCC0020) ;
   
        BitBlt( hdc_frontbuffer, pos_x, pos_y, thumb_w, thumb_h
              , hdc_thumbnails,  pos_x, pos_y ,0xCC0020) ;
      }   
   }

    old_ids_count := ids_count 
    old_rows := rows
    old_cols := cols
   old_num_win := num_win

    Loop %num_win%  {                       ; task_ids, dims have been set up in win_list
      Sleep %yield%                        ; CPU cycles to other tasks @ frequent redraw
      If Stop_Drawing
         Break
   
      pos_x := thumb_w * Mod(A_Index-1,cols)
      pos_y := thumb_h * ((A_Index-1)//cols)
     
      PrintWindow( task_ids_%A_Index%, hdc_printwindow, 0) ; 0=window, 1=Child(no toolbars)
   
      BitBlt( hdc_thumbnails, pos_x , pos_y, thumb_w, thumb_h
            , hdc_desktop   , pos_x , pos_y ,0xCC0020) ; Clear slot . (could load Image here ?)
   
      ; prevent flicker with backbuffer , store it in hdc_thumbnails for later reuse!
      StretchBlt( hdc_thumbnails , pos_x + ( thumb_w - thumb_w%A_Index% ) // 2
                            , pos_y + ( thumb_h - thumb_h%A_Index% ) // 2      
                            , thumb_w%A_Index%
                          , thumb_h%A_Index%
             ,hdc_printwindow, 0, 0, w%A_Index%, h%A_Index% ,0xCC0020) ; SRCCOPY
 
        BitBlt( hdc_frontbuffer, pos_x , pos_y , thumb_w, thumb_h
             ,hdc_thumbnails,  pos_x , pos_y ,0xCC0020) ; Clear slot . (could load Image here ?)
   }
     
   If live_redraw           ; redraw thumbnails until Break is set
         Gosub draw_thumbnails
Return

Animate_In:
    if !animate_in_steps
        return

    SetStretchBltMode(hdc_backbuffer, quality_low) ; 3: Lower quality at 1st draw
   
   A_index2 := pos
    pos_x := thumb_w * Mod(A_Index2-1,cols)
    pos_y := thumb_h * ((A_Index2-1)//cols)
 
    PrintWindow(task_ids_%A_Index2%,hdc_printwindow,0)
 
    task_id := task_ids_%A_Index2%
   WinGetPos, diff_x, diff_y, diff_w, diff_h , ahk_id %task_id%

    diff_x := diff_x - ( pos_x + (thumb_w - thumb_w%A_Index2% ) // 2 ) - WorkArea_Left
   diff_y := diff_y - ( pos_y + (thumb_h - thumb_h%A_Index2% ) // 2 ) - WorkArea_Top
     diff_w := diff_w - ( thumb_w%A_Index2% )
   diff_h := diff_h - ( thumb_h%A_Index2% )
    
   Loop %animate_in_steps%
   {
       sleep %animate_in_delay%
          zoom := 1 - ( A_Index / animate_in_steps )
      
        BitBlt( hdc_backbuffer, 0, 0, WorkArea_Width, WorkArea_Height
           , hdc_thumbnails, 0, 0 , 0xCC0020) ; SRCCOPY
   
      if ( zoom = 0 )
         SetStretchBltMode(hdc_backbuffer, quality_high) ; 3: Lower quality at 1st draw
      StretchBlt( hdc_backbuffer , pos_x + (thumb_w - thumb_w%A_Index2% ) // 2 + diff_x * zoom      
                           , pos_y + (thumb_h - thumb_h%A_Index2% ) // 2 + diff_y * zoom      
                           , thumb_w%A_Index2% + diff_w * zoom   
                           , thumb_h%A_Index2% + diff_h * zoom
                   , hdc_printwindow, 0, 0, w%A_Index2%, h%A_Index2% ,0xCC0020) ; SRCCOPY
      if ( zoom = 0 )
         SetStretchBltMode(hdc_backbuffer, quality_low) ; 3: Lower quality at 1st draw
      Gui_Show()
      BitBlt(hdc_frontbuffer, 0, 0 ,WorkArea_Width ,WorkArea_Height
              ,hdc_backbuffer , 0, 0 ,0xCC0020) ; SRCCOPY
   }
   old_cols := cols ; prevent full refresh on next draw
    old_rows := rows
Return

; should be reverse of animate in ? combine them ...
Animate_Out:
   if !animate_out_steps
         return

   A_index2 := pos
    pos_x := thumb_w * Mod(A_Index2-1,cols)
    pos_y := thumb_h * ((A_Index2-1)//cols)
 
    If (!(pos <= num_win and X >= 0 and X <= WorkArea_Width and Y >= 0 and Y <= WorkArea_Height))
       return

   ;SetStretchBltMode(hdc_frontbuffer,quality_low) ;
    PrintWindow( task_ids_%A_Index2%, hdc_printwindow ,0) ; get selected window
   
   ; clear
     BitBlt( hdc_backbuffer, pos_x, pos_y, thumb_w, thumb_h
          , hdc_desktop   , pos_x, pos_y, 0xCC0020) ; clear with desktopimage

   task_id := task_ids_%A_Index2%
   WinGetPos, diff_x, diff_y, diff_w, diff_h , ahk_id %task_id%

    diff_x := diff_x - ( pos_x + (thumb_w - thumb_w%A_Index2% ) // 2 ) - WorkArea_Left
   diff_y := diff_y - ( pos_y + (thumb_h - thumb_h%A_Index2% ) // 2 ) - WorkArea_Top
   diff_w := diff_w - ( thumb_w%A_Index2% )
   diff_h := diff_h - ( thumb_h%A_Index2% )

   SetStretchBltMode(hdc_backbuffer,quality_low) ; 3: Lower quality at 1st draw
    Loop %animate_out_steps%
   {
       sleep %animate_out_delay%
          zoom := ( A_Index / animate_out_steps )
        
      ; you can comment this line to get bit speed, acceptable
      BitBlt( hdc_backbuffer, 0, 0, WorkArea_Width, WorkArea_Height
              , hdc_thumbnails, 0, 0, 0xCC0020) ; SRCCOPY
      
      StretchBlt( hdc_backbuffer, pos_x + (thumb_w - thumb_w%A_Index2% ) // 2 + diff_x * zoom
                           , pos_y + (thumb_h - thumb_h%A_Index2% ) // 2 + diff_y * zoom
                           , thumb_w%A_Index2% + diff_w * zoom
                           , thumb_h%A_Index2% + diff_h * zoom
                   ,hdc_printwindow, 0, 0, w%A_Index2%, h%A_Index2% ,0xCC0020) ; SRCCOPY
   
       BitBlt(hdc_frontbuffer, 0, 0, WorkArea_Width, WorkArea_Height
             ,  hdc_backbuffer, 0, 0 ,0xCC0020) ; SRCCOPY
     }
   
Return

fade_in:
   ; not used ?
Return

fade_out:
   ; fade last animate_out with real desktop
Return

Gui_Show() {
   global
   if Shown
      return
   Gui, Show
   Shown = 1
}

Gui_Hide() {
   global
   if !Shown
     return
   Gui, Hide
   Shown =
}

hide_gui:
   Stop_Drawing = 1
   Gui_Hide()
   WinActivate(ActiveID)                   ; activate last active window
Return

handle_exit:
   Gui Destroy
   ReleaseDC(hw_frame,hdc_frontbuffer) ; free lock?
   DeleteObject( hbm_printwindow)
   DeleteDC(     hdc_printwindow)
   DeleteObject( hbm_window)
   DeleteDC(     hdc_window)
   DeleteObject( hbm_backbuffer)
   DeleteDC(     hdc_backbuffer)
 ;  WinActivate ahk_id %ActiveID%           ; activate last active window
ExitApp

; --------------------------------------------------------------------------------------------------
; Library: no need to modify below

; Libary (could be put in extra file )
; #include <GDI.ahk>
; for documentation of commands see: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/wingdistart_9ezp.asp

; -- highlevel not direct dllcall mapping , simplifiers
CreateDCBuffer(ByRef hdc_from, ByRef hdc_to, ByRef hbm_to, w ,h ) {
   ; does not work, something wrong with ByRef and global
   hdc_to  := CreateCompatibleDC(hdc_from) ; buffer
   hbm_to  := CreateCompatibleBitmap(hdc_from,w,h)
   old     := SelectObject(hdc_to,hbm_to)
}

; -- mfc wrapper
GetDC( hw ) {
   return DLLCall("GetDC", UInt, hw )
}

CreateDC( driver,device,output,mode  ) {
   return DLLCall("GetDC", UInt, driver, UInt, device, UInt, output, UInt, mode )
}

SetStretchBltMode( hdc , value ) {
     return DllCall("gdi32.dll\SetStretchBltMode", UInt,hdc, "int",value)
}

CreateCompatibleDC( hdc ) {
   return DllCall("gdi32.dll\CreateCompatibleDC", UInt,hdc)
}

CreateCompatibleBitmap( hdc , w, h ) {
     return DllCall("gdi32.dll\CreateCompatibleBitmap", UInt,hdc, Int,w, Int,h)
}

SelectObject( hdc , hbm ) {
   return DllCall("gdi32.dll\SelectObject", UInt,hdc, UInt,hbm)
}

DeleteObject( hbm ) {
   return DllCall("gdi32.dll\DeleteObject", UInt,hbm)   
}

DeleteDC( hdc ) {
   return DllCall("gdi32.dll\DeleteDC", UInt,hdc )
}

ReleaseDC( hwnd, hdc ) {
   return DllCall("gdi32.dll\ReleaseDC", UInt,hwnd,UInt,hdc )
}

PrintWindow( window_id , hdc , mode ) {
   return DllCall("PrintWindow", UInt, window_id , UInt,hdc, UInt, mode)
}

StretchBlt( hdc_dest , x1, y1, w1, h1, hdc_source , x2, y2, w2, h2 , mode) {
   return DllCall("gdi32.dll\StretchBlt"
          , UInt,hdc_dest  , Int,x1, Int,y1, Int,w1, Int,h1
             , UInt,hdc_source, Int,x2, Int,y2, Int,w2, Int,h2
          , UInt,mode)
}

BitBlt( hdc_dest, x1, y1, w1, h1 , hdc_source, x2, y2 , mode ) {
   return DllCall("gdi32.dll\BitBlt"
          , UInt,hdc_dest   , Int, x1, Int, y1, Int, w1, Int, h1
             , UInt,hdc_source    , Int, x2, Int, y2
          , UInt, mode)
}

PaintDesktop(  hdc ) {
   return DllCall("PaintDesktop", UInt, hdc )
}

; constants
; see: http://www.adaptiveintelligence.net/Developers/Reference/Win32API/GDIConstants.aspx
; #SRCCOPY = 0xCC0020




Last edited by holomind on Fri Oct 13, 2006 6:37 am; edited 27 times in total
Back to top
View user's profile Send private message Visit poster's website
Veovis



Joined: 13 Feb 2006
Posts: 390
Location: Utah

PostPosted: Sun Oct 01, 2006 3:38 am    Post subject: Reply with quote

EXCELLENT!!!

this is way cool!

i have always loved macs expose. its so useful and intuitive. unlike alt-tabbing through a bunch of icons or looking for the name of your program in the taskbar, expose is intuitive and easy.

While this does go a little slow on my 1 Ghz lappy, i am very pleased with the feel. I noticed that there is a lot of black space if you have some small windows open, but that isnt a problem really, and it would be complicated to compute window sizes so the fit together better.

I also changed the transparency so it goes black because it was slightly disorienting to see parts of a different window behind the small thumbnails.

Overall, Very nice job!
_________________

"Power can be given overnight, but responsibility must be taught. Long years go into its making."
Back to top
View user's profile Send private message Send e-mail Visit poster's website
koro



Joined: 24 Sep 2006
Posts: 60

PostPosted: Sun Oct 01, 2006 3:44 am    Post subject: bogus? Reply with quote

The first time i tried it worked fine, but now it's randomly showing 1 or 2 windows only, not all of the open windos. in fact right now it only shows 1, everytime. I re-downloaded the script since i may have pasted something wrong but no...
Back to top
View user's profile Send private message
Veovis



Joined: 13 Feb 2006
Posts: 390
Location: Utah

PostPosted: Sun Oct 01, 2006 4:03 am    Post subject: Reply with quote

hmmmm your right. right now it only shows 4 of the 6 that are open. it might be due to the ... somewhat odd nature of the google talk windows, but i recall them working earlier... any ideas?
_________________

"Power can be given overnight, but responsibility must be taught. Long years go into its making."
Back to top
View user's profile Send private message Send e-mail Visit poster's website
SoggyDog



Joined: 02 May 2006
Posts: 179
Location: Denver, CO

PostPosted: Sun Oct 01, 2006 6:45 am    Post subject: Reply with quote

I absolutely love it...
However, I also have windows that don't show up.

Exclamation This really is a fantastic script Exclamation
_________________

SoggyDog
Download AutoHotKey Wallpaper
Does Fuzzy Logic tickle?
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
holomind



Joined: 11 Mar 2006
Posts: 297
Location: Munich, Germany

PostPosted: Sun Oct 01, 2006 10:26 am    Post subject: Reply with quote

i also noticed that windows sometimes do not show acutally they are completele black (but not missing). its a problem with the printwindow() function. and perhaps shows up when many windows are open. if i have 4windows or 8windows it works but with more it can give black windows.

the msdn api says it returns if it was successfull, but in my case it also returns 1 if its black. one trick would be to draw it repeatadly calling the draw_thumbnails in a loop (every second) to repaint it, then the chance is quite good next time its correct.
in the beginning i had the gui: add picture just after the printwindow and got lots of black frames, i move the gui add to a different location in the code and it didnt interfere anymore. there are many people complaining about black frames in printwindow and its quite unreliable. even commercial tools have this problem.
perhaps one could do a pixel search on the lower half of the thumbnail and if its black then repaint the window. perhaps search on the windowborder so you dont hit real black text or background by accident.

you have the code so you can tweak it.
performace should not be the greatest as all is done in printwindow and bitblt. (fast but slower than directx or opengl).

on the other hand bitblt-ing the desktop never gives black frames, so you could buffer the images and then show them, but this makes it more complicate.

as i didnt notice blackframes in my useage i hadnt the need to optimize it.

for debugging it would be interessting:
a) number of windows when showing expose
b) your screenresolution
c) ghz of cpu, and perhaps brand of gfx-card (shared or realmemory)

eg. i have 6windows, 1400x1050 intel-i850 gfx with no problems
Back to top
View user's profile Send private message Visit poster's website
holomind



Joined: 11 Mar 2006
Posts: 297
Location: Munich, Germany

PostPosted: Sun Oct 01, 2006 10:28 am    Post subject: Reply with quote

did you notice the size-filter? it hides windows smaller than 200px-width or lower than 200px height. this way i hide windows on purpose like taskbar. maybe some sidebars and other small windows "disappear", this is by purpouse.
you can tweak the min_w and min_h in the readconfig functions to allow other windows.
Back to top
View user's profile Send private message Visit poster's website
holomind



Joined: 11 Mar 2006
Posts: 297
Location: Munich, Germany

PostPosted: Sun Oct 01, 2006 10:39 am    Post subject: Reply with quote

Veovis wrote:

While this does go a little slow on my 1 Ghz lappy, i am very pleased with the feel. I noticed that there is a lot of black space if you have some small windows open, but that isnt a problem really, and it would be complicated to compute window sizes so the fit together better.


it is a bit slow due to the fade_in/out also the printwindow (actually repainting each of your windows in realtime instead of just making a screenshot, printwindow() is much slower than bitblt the desktop) you could speed this up with buffers but then need more memory etc. (many expose tools give you the option to optimize it for speed, memory or smoothness etc. this is the "basic" version Wink

the windows could be zoomed but the complicated part is not to distort the image, you can easily set thumb_w2 = thumb_w and thumb_h2=thumb_h and it uses all space but distorts then, i tried it but didnt do the math right Wink also it makes the code longer and harder to understand.
(also if width > height you need to reduce width, otherwise the width, not so easy)

thanks for the compliments Wink
Back to top
View user's profile Send private message Visit poster's website
holomind



Joined: 11 Mar 2006
Posts: 297
Location: Munich, Germany

PostPosted: Sun Oct 01, 2006 11:50 am    Post subject: Reply with quote

the script is now a bit longer, but i implemented the suggested ideas:

a) small windows are scaled to fit the avalable space in this grid-zone.
no tetris stacking yet Wink (which i personally dont like)

b) you can set the end of animation to solid if you set
read_config: translevel_stop_solid to 1

c) the window filter is now in a separate function so you can easily adopt it to your needs. i have to hide my deskman window and my objectdock-tab-folderbar, which would mess it up. also expose itself is hidden.

i think there is not a big problem with black frames in printwindow, but windows are hidden because of their size. for me expose works like expected Wink
Back to top
View user's profile Send private message Visit poster's website
majkinetor



Joined: 24 May 2006
Posts: 3544
Location: Belgrade

PostPosted: Sun Oct 01, 2006 11:55 am    Post subject: Reply with quote

Superb homind, this is exactly what I wanted up to the animation.

The bugs are of course, present in this first release, windows are dropped somehow. First time when I run it, all were there except console. I restarted the script and only console and opera were there, and on next F12, console dissappeared leaving opera small in one corner. On next F12, Opera was big, using all the screen. Smile))


BTW, I have an advice to you. You should change the layout of your presentation with something more structural. I had a problem with your other script using this and that - well, not really a problem but it was more time consuming then it should be. So, I suggest you to put download cleanly visible and direct links to scripts u used if you didn't merge all scripts at the end (ExpandIncludes.ahk). You can also provide archive with all the additionals used by your main script. I also noticed that Chris created overview for one of your scripts witch shouldn't happen in the first place if they are structured well. Consider that some of us don't have enough time to read every word and/or entire thread, and want to "jump in" in fastest way. If you supply usability & installation data clearly visible and separated of other text, they are able to do that.
_________________
Back to top
View user's profile Send private message MSN Messenger
holomind



Joined: 11 Mar 2006
Posts: 297
Location: Munich, Germany

PostPosted: Sun Oct 01, 2006 11:59 am    Post subject: Reply with quote

majkinetor wrote:
...visible and direct links to scripts u used if you didn't merge all scripts at the end (ExpandIncludes.ahk).


you dont understand its only this script and no includes whatsoever.
i always put the download link above the code so people can easliy download it instead of copy+paste it into notepad and save ..

is this to complicated ? this forum is an exchange of script-CODE and not to sell executables.
Back to top
View user's profile Send private message Visit poster's website
holomind



Joined: 11 Mar 2006
Posts: 297
Location: Munich, Germany

PostPosted: Sun Oct 01, 2006 12:31 pm    Post subject: Reply with quote

the scale function is now bugfixes, i hope it scales the windows without distortion now.

majkinetor suggested to use wallpaper instead of black background, so we wait what he comes up with, as i dont use any wallpaper i dont know how to do it Wink
Back to top
View user's profile Send private message Visit poster's website
majkinetor



Joined: 24 May 2006
Posts: 3544
Location: Belgrade

PostPosted: Sun Oct 01, 2006 12:48 pm    Post subject: Reply with quote

Quote:
you dont understand its only this script and no includes whatsoever.
i always put the download link above the code so people can easliy download it instead of copy+paste it into notepad and save ..

I don't talk about this script.

Quote:
is this to complicated ? this forum is an exchange of script-CODE and not to sell executables.

It is not too complicated. Who is talking about selling executables ?
I wish there is some standard form of presentation here....
_________________
Back to top
View user's profile Send private message MSN Messenger
holomind



Joined: 11 Mar 2006
Posts: 297
Location: Munich, Germany

PostPosted: Sun Oct 01, 2006 12:54 pm    Post subject: Reply with quote

majkinetor wrote:
I wish there is some standard form of presentation here....


ok, thats what you want, but you wont get this in short term. there are too many different ways presenting script in this forum , also the codestyle etc.

you would need a "template" or "form" to fill out and have consistency. this is a "forum" software Wink

its hard enough that the code is in the first post and updated there Wink
Back to top
View user's profile Send private message Visit poster's website
Laszlo



Joined: 14 Feb 2005
Posts: 3877
Location: Pittsburgh

PostPosted: Sun Oct 01, 2006 6:26 pm    Post subject: Reply with quote

This is a very nice script. I will use a version of it all the time. Thanks Holomind for sharing it. (Don't worry about the comments on the format. It is fine!).

I only have problems with disappearing command prompt (console) windows (Version 0.3). They randomly show up or remain black after pressing F12. All other windows behave properly.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page 1, 2, 3 ... 14, 15, 16  Next
Page 1 of 16

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group