mirror of
https://github.com/moparisthebest/Simba
synced 2024-11-25 02:32:19 -05:00
When the window selector hovers over a window that can be made transparent, it will make it transparent.
git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@287 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
parent
28f5c30785
commit
78af57e181
@ -34,7 +34,7 @@ uses
|
|||||||
controls,
|
controls,
|
||||||
graphics,
|
graphics,
|
||||||
forms,
|
forms,
|
||||||
{$IFNDEF MSWINDOWS}x, xlib
|
{$IFNDEF MSWINDOWS}x, xlib,xatom
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
windows
|
windows
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
@ -87,17 +87,27 @@ var
|
|||||||
x, y : cint;
|
x, y : cint;
|
||||||
Old_Handler : TXErrorHandler;
|
Old_Handler : TXErrorHandler;
|
||||||
|
|
||||||
|
window_opacity: TAtom;
|
||||||
|
opacity_75: culong;
|
||||||
|
opacity_100: culong;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Old_Handler := XSetErrorHandler(@MufasaXErrorHandler);
|
Old_Handler := XSetErrorHandler(@MufasaXErrorHandler);
|
||||||
|
|
||||||
Result := 0;
|
Result := 0;
|
||||||
|
|
||||||
|
window_opacity:=XInternAtom(Window.XDisplay,PChar('_NET_WM_WINDOW_OPACITY'), False);
|
||||||
|
opacity_75 := cuint($ffffffff * 0.75);
|
||||||
|
opacity_100 := cuint($ffffffff);
|
||||||
|
|
||||||
repeat
|
repeat
|
||||||
|
// get pointer pos + current window we are at.
|
||||||
XQueryPointer(Window.XDisplay, Window.DesktopWindow, @root,
|
XQueryPointer(Window.XDisplay, Window.DesktopWindow, @root,
|
||||||
@Tempwindow, @x_root, @y_root,
|
@Tempwindow, @x_root, @y_root,
|
||||||
@x, @y, @xmask);
|
@x, @y, @xmask);
|
||||||
subwindow:= Tempwindow;
|
subwindow:= Tempwindow;
|
||||||
|
|
||||||
|
// find the most `child' window.
|
||||||
while subwindow <> 0 do
|
while subwindow <> 0 do
|
||||||
begin
|
begin
|
||||||
Tempwindow := subwindow;
|
Tempwindow := subwindow;
|
||||||
@ -105,16 +115,33 @@ begin
|
|||||||
@subwindow, @x_root, @y_root,
|
@subwindow, @x_root, @y_root,
|
||||||
@x, @y, @xmask);
|
@x, @y, @xmask);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if Result <> Tempwindow then
|
if Result <> Tempwindow then
|
||||||
begin
|
begin
|
||||||
WriteLn('Changing Window to: ' + IntToStr(Tempwindow));
|
writeln('Making ' + inttostr(tempwindow) + ' transparent');
|
||||||
|
XChangeProperty(Window.XDisplay, tempwindow, window_opacity, XA_CARDINAL, 32, PropModeReplace, @opacity_75, 1);
|
||||||
|
|
||||||
|
writeln('Resetting ' + inttostr(Result));
|
||||||
|
if result <> 0 then
|
||||||
|
XChangeProperty(Window.XDisplay, Result, window_opacity, XA_CARDINAL, 32, PropModeReplace, @opacity_100, 1);
|
||||||
|
WriteLn('Changing Window from: ' + Inttostr(result) +' to: ' + IntToStr(Tempwindow));
|
||||||
|
// XChangeProperty(Window.XDisplay, tempwindow, window_opacity, XA_CARDINAL, 32, PropModeReplace, @opacity_50, 1);
|
||||||
|
|
||||||
Result := Tempwindow;
|
Result := Tempwindow;
|
||||||
end;
|
end;
|
||||||
|
XFlush(Window.XDisplay);
|
||||||
Sleep(16);
|
Sleep(16);
|
||||||
|
|
||||||
|
//if we are selecting for a long time, we must still process other messages
|
||||||
|
Application.ProcessMessages;
|
||||||
|
|
||||||
until (xmask and Button1Mask) = 0;
|
until (xmask and Button1Mask) = 0;
|
||||||
|
|
||||||
|
XChangeProperty(Window.XDisplay, Result, window_opacity, XA_CARDINAL, 32, PropModeReplace, @opacity_100, 1);
|
||||||
|
XFlush(Window.XDisplay);
|
||||||
|
|
||||||
XSetErrorHandler(Old_handler);
|
XSetErrorHandler(Old_handler);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user