 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
IN2ITive
Joined: 15 Apr 2008 Posts: 47
|
Posted: Sat May 17, 2008 5:59 pm Post subject: |
|
|
Ok, while this may not be the best implementation I have changed the functionality so that if no window is zoomed then all thumbnails are refreshed. If there is a zoomed window then only the zoomed window is refreshed. All I did was copy/paste some of the draw_thumbnails functionality into the draw_active function.
I did notice that some windows, especially non-maximized windows behaved differently if they were in different positions of the grid. For example, a non maximized notepad window that was in the top right hand corner of the grid would move to the left side if the window was zoomed. If the same window was maximized then when zoomed it was stuck to the right hand side of the screen (correct functionality). A minor annoyance but if anyone wants to take a shot at it...
Again, my implementation may be not the ideal one but it suits my need to have all thumbnails refreshed if there are no zoomed windows.
The other issue I am having is the bottom row of the grid...the windows when zoomed do not have their bottom edge aligned with the bottom edge of the screen (the bottom part of the window is below the bottom edge)...again a minor annoyance but would be great to have a fix for it.
| Code: | ;v1.20080517 -- expose.ahk - Thumbnails of windows over the working area, active thumbnails when no zoom, ;zoomed window means redraw only zoomed window
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, MButton , Window_Activate
Hotkey, LButton , Window_Activate
HotKey, RButton , Window_Preview
Hotkey, Esc , hide_gui
Hotkey, WheelUp , Handle_Zoom
Hotkey, WheelDown, Handle_Zoom
Hotkey, +MButton , handle_exit ; panik-key
Hotkey, #F12 , Debug_Info
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 = 100 ; 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
zoom_preview = 0.8
do_zoom := 0 ; // off at first
Return
Debug_Info:
ListLines
Window_Hidden() {
global
Return w < min_w or h < min_h or title ="»Expose«" or title =""
}
Handle_Zoom:
If (zoom_preview < 4 and ( A_ThisHotKey = "WheelUp" or A_ThisHotKey = "^+Up" ))
zoom_preview += 0.1 ; sqrt(sqrt(2))
If (zoom_preview > -1 and ( A_ThisHotKey = "WheelDown" or A_ThisHotKey = "^+Down" ))
zoom_preview -= 0.1
TrayTip,,% "Zoom = " Round(100*(1+zoom_preview)) "%"
Return
In(x,a,b) { ; closest number to x in [a,b]
IfLess x,%a%, Return a
IfLess b,%x%, Return b
Return x
}
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 )
{
tooltip,
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
BitBlt( hdc_thumbnails, 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 ?)
}
MouseGetPos X, Y
pos := 1 + X*cols//WorkArea_Width + Y*rows//WorkArea_Height * cols
winid := task_ids_%pos%
WinGetTitle title, ahk_id %winid%
tooltip, %title% ; + %old_pos2% + %pos%
If live_redraw
{
Gosub draw_active
Return
}
Return
Window_Preview:
do_zoom := 1 - do_zoom ; toggle state
BitBlt(hdc_frontbuffer, 0, 0, WorkArea_Width, WorkArea_Height
, hdc_thumbnails, 0, 0 ,0xCC0020) ; SRCCOPY
return
draw_active:
zoom := zoom_preview
sleep %yield% ; CPU cycles to other tasks @ frequent redraw
If ( Stop_Drawing )
{
tooltip,
Return
}
MouseGetPos X, Y
pos := 1 + X*cols//WorkArea_Width + Y*rows//WorkArea_Height * cols
winid := task_ids_%pos%
pos_x := thumb_w * Mod(pos -1,cols)
pos_y := thumb_h * ((pos -1)//cols)
A_Index2 := pos
task_id := task_ids_%A_Index2%
diff_x := WorkArea_Left
diff_y := WorkArea_Top
diff_w := WorkArea_Width
diff_h := WorkArea_Height
WinGetPos, diff_x, diff_y, diff_w, diff_h , ahk_id %task_id%
diff_x := X - diff_w // 2 ; - ( WorkArea_Width - WorkArea_Left ) // 2
diff_y := Y - diff_h // 2 ; - ( WorkArea_Height - WorkArea_Top ) // 2
if ( pos_x + diff_x + (diff_w//2) *zoom > Work_AreaWidth )
diff_x := Work_AreaWidth - ( (diff_w//2) *zoom)
if diff_x < 1
diff_x :=1
if diff_y < 1
diff_y := 1
; if ( diff_y + thumb_h * zoom > Work_AreaHeight )
; diff_y := Work_AreaHeight - thumb_h * zoom
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% )
; 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
PrintWindow( task_ids_%A_Index2%, hdc_printwindow, 0) ; 0=window, 1=Child(no toolbars)
SetStretchBltMode(hdc_backbuffer,quality_high) ; 3: Lower quality at 1st draw
SetStretchBltMode(hdc_frontbuffer,quality_high) ; 3: Lower quality at 1st draw
if ( do_zoom = 1 ) {
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
}
else {
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 ?)
}
}
MouseGetPos X, Y
pos := 1 + X*cols//WorkArea_Width + Y*rows//WorkArea_Height * cols
winid := task_ids_%pos%
WinGetTitle title, ahk_id %winid%
tooltip, %title% ; + %old_pos2% + %pos%
If live_redraw
{
Gosub draw_active
Return
}
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
tooltip,
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 |
|
|
| Back to top |
|
 |
Thrawn
Joined: 12 May 2008 Posts: 9 Location: Germany
|
Posted: Thu May 22, 2008 1:17 pm Post subject: |
|
|
Hi
using this function
| Code: | minAnimation(set="")
{
VarSetCapacity(AnimationInfo, 8,0)
cbSize := VarSetCapacity(AnimationInfo)
NumPut(cbSize, AnimationInfo, 0, "UInt")
if set =
{
DllCall("SystemParametersInfo", UInt, 0x48, UInt, cbSize, "UInt", &AnimationInfo, UInt, 1 )
return NumGet(AnimationInfo,4)
}
if (set = 0 || set = 1)
{
NumPut(cbSize, AnimationInfo, 0, "UInt")
NumPut(set, AnimationInfo, 4, "Int")
DllCall("SystemParametersInfo", UInt, 0x49, UInt, cbSize, "UInt", &AnimationInfo, UInt, 1 )
return 1
}
return 0
} |
you can enable/disable the OS animations for min/maximizing windows. This way it is possible to WinRestore all minimized windows, show them as thumbnails and WinMinimize them again when hiding the gui window. |
|
| Back to top |
|
 |
holomind
Joined: 11 Mar 2006 Posts: 300 Location: Munich, Germany
|
Posted: Tue May 27, 2008 11:06 am Post subject: |
|
|
Hi, really nice to see the script evolves. somehow i lost my forum notifications and did not check for a while. but the good thing is, that the script was changed in meantime... I didnt think about the refresh-all feature, i turned it off to get more speed, but its good to keep it in not-zoomed mode *clever*.
about the placement of the zoomed window. this is not perfect jet, and you are right that it does not behave as expected on the last row. perhaps it would be better to improve placement. perfect one would be to use the animate-out function/algorithm. which already does perfect scaling of the window. because scaling to 1:1 original window is normally enough.
the minimized feature could be done, thanks for the code to unminimize/minimize the windows. you are right because printwindow can only show windows which are not hidden or minimized. but it can show them if they are offscreen (eg. x=10000, y=10) funny behavior of printwindow.
perhaps it should be an config-option to "show hidden windows : on/off" ? because there are some windows which dont behave well after unminimize/minimize. (or one could exclude them ?)
greetings,
Holomind |
|
| Back to top |
|
 |
Kahz
Joined: 12 Sep 2005 Posts: 189
|
Posted: Wed Aug 06, 2008 6:42 am Post subject: |
|
|
This script doesn't work for me. When I hit Win-Tab the active window loses focus but nothing appears on the screen.
I use the alternative shell Litestep with Windows XP. Could this be the reason? |
|
| Back to top |
|
 |
holomind
Joined: 11 Mar 2006 Posts: 300 Location: Munich, Germany
|
Posted: Wed Aug 06, 2008 7:37 am Post subject: |
|
|
| Mistrel wrote: | This script doesn't work for me. When I hit Win-Tab the active window loses focus but nothing appears on the screen.
I use the alternative shell Litestep with Windows XP. Could this be the reason? |
The simple answer is yes. Litestep changes much Internal APIs of Windows and breaks AHK and GDI/GDIPlus functions. I guess many other Scripts here using GDI will not work correctly. (If you use litestep you maybe should use another (commercial) expose-application like "TopDesk". )
Perhaps Litestep also Uses the Win-Tab-Key. Have you tried the Mouse-Key Middle-Click in some Implementations of Expose-Clone ? |
|
| Back to top |
|
 |
automaticman
Joined: 27 Oct 2006 Posts: 372
|
Posted: Tue Aug 26, 2008 10:38 am Post subject: |
|
|
Thanks for sharing this useful script. I am using
| Code: | | ; v1.01 -- expose.ahk | which I downloaded from the first post in this thread, is this the latest?
And what about combining this with the ideas here: http://www.autohotkey.com/forum/viewtopic.php?t=32824
or was this already done? (Sorry I didn't read anything in this thread, just wanted to share my thoughts quickly here.) |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|