mirror of
https://github.com/moparisthebest/Simba
synced 2025-02-16 07:10:10 -05:00
git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@89 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
parent
8f7966e002
commit
f279ee1489
@ -1,11 +1,11 @@
|
||||
object Form1: TForm1
|
||||
Left = 1103
|
||||
Left = 400
|
||||
Height = 541
|
||||
Top = 82
|
||||
Top = 129
|
||||
Width = 763
|
||||
ActiveControl = SynEdit1
|
||||
Caption = 'Mufasa v2'
|
||||
ClientHeight = 516
|
||||
ClientHeight = 521
|
||||
ClientWidth = 763
|
||||
Menu = MainMenu1
|
||||
OnCreate = FormCreate
|
||||
@ -25,6 +25,7 @@ object Form1: TForm1
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
TabOrder = 0
|
||||
BookMarkOptions.OnChange = nil
|
||||
Gutter.Width = 57
|
||||
Gutter.MouseActions = <
|
||||
item
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -65,7 +65,7 @@ var
|
||||
|
||||
implementation
|
||||
uses
|
||||
lclintf,plugins;
|
||||
lclintf,plugins,windows;
|
||||
|
||||
|
||||
|
||||
@ -77,11 +77,12 @@ Var
|
||||
begin
|
||||
MMLPSThread := TMMLPSThread.Create(True);
|
||||
MMLPSThread.SetPSScript(Form1.SynEdit1.Lines.Text);
|
||||
// MMLPSThread.Client.MWindow.SetTarget(461670,w_Window);
|
||||
MMLPSThread.SetDebug(Form1.Memo1);
|
||||
|
||||
// This doesn't actually set the Client's MWindow to the passed window, it
|
||||
// only copies the current set window handle.
|
||||
MMLPSThread.Client.MWindow.SetWindow(Form1.Window);
|
||||
MMLPSThread.Client.MWindow.SetTarget(GetDesktopWindow,w_window);
|
||||
|
||||
MMLPSThread.Resume;
|
||||
end;
|
||||
@ -127,8 +128,8 @@ end;
|
||||
procedure TForm1.Selector_DOWN(Sender: TObject; Button: TMouseButton;
|
||||
Shift: TShiftState; X, Y: Integer);
|
||||
begin
|
||||
Window.SetTarget(Selector.Drag);
|
||||
writeln('New window: ' + IntToStr(Window.CurWindow));
|
||||
Window.SetTarget(Selector.Drag {$ifdef MSWINDOWS},w_window{$endif});
|
||||
writeln('New window: ' + IntToStr(Window.TargetHandle));
|
||||
end;
|
||||
|
||||
|
||||
|
@ -1,107 +1,156 @@
|
||||
unit windowselector;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils,
|
||||
ctypes,
|
||||
window, windowutil,
|
||||
{$IFNDEF MSWINDOWS}x, xlib
|
||||
{$ELSE}
|
||||
windows
|
||||
{$ENDIF}
|
||||
|
||||
;
|
||||
|
||||
type
|
||||
TMWindowSelector = class(TObject)
|
||||
constructor Create(aWindow: TMWindow);
|
||||
destructor Destroy; override;
|
||||
|
||||
{$IFDEF LINUX}
|
||||
function Drag: x.TWindow;
|
||||
{$ELSE}
|
||||
function Drag: Hwnd;
|
||||
{$ENDIF}
|
||||
|
||||
public
|
||||
Window: TMWindow;
|
||||
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
|
||||
constructor TMWindowSelector.Create(aWindow: TMWindow);
|
||||
begin
|
||||
inherited create;
|
||||
|
||||
Self.Window := aWindow;
|
||||
|
||||
end;
|
||||
|
||||
|
||||
destructor TMWindowSelector.Destroy;
|
||||
begin
|
||||
|
||||
inherited;
|
||||
end;
|
||||
|
||||
{$IFDEF LINUX}
|
||||
function TMWindowSelector.Drag: x.TWindow;
|
||||
var
|
||||
Tempwindow : x.TWindow;
|
||||
root : x.TWindow;
|
||||
subwindow : x.TWindow;
|
||||
x_root, y_root : cint;
|
||||
xmask : cuint;
|
||||
x, y : cint;
|
||||
Old_Handler : TXErrorHandler;
|
||||
|
||||
begin
|
||||
Old_Handler := XSetErrorHandler(@MufasaXErrorHandler);
|
||||
|
||||
Result := 0;
|
||||
|
||||
repeat
|
||||
XQueryPointer(Window.XDisplay, Window.DesktopWindow, @root,
|
||||
@Tempwindow, @x_root, @y_root,
|
||||
@x, @y, @xmask);
|
||||
subwindow:= Tempwindow;
|
||||
|
||||
while subwindow <> 0 do
|
||||
begin
|
||||
Tempwindow := subwindow;
|
||||
XQueryPointer(Window.XDisplay, Tempwindow, @root,
|
||||
@subwindow, @x_root, @y_root,
|
||||
@x, @y, @xmask);
|
||||
end;
|
||||
if Result <> Tempwindow then
|
||||
begin
|
||||
WriteLn('Changing Window to: ' + IntToStr(Tempwindow));
|
||||
Result := Tempwindow;
|
||||
end;
|
||||
|
||||
Sleep(16);
|
||||
|
||||
until (xmask and Button1Mask) = 0;
|
||||
|
||||
XSetErrorHandler(Old_handler);
|
||||
end;
|
||||
|
||||
{$ELSE}
|
||||
|
||||
function TMWindowSelector.Drag: Hwnd;
|
||||
|
||||
begin
|
||||
// Moet jij maar ff doen, ray.
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
|
||||
|
||||
end.
|
||||
|
||||
unit windowselector;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils,
|
||||
ctypes,
|
||||
window, windowutil,
|
||||
controls,
|
||||
graphics,
|
||||
forms,
|
||||
{$IFNDEF MSWINDOWS}x, xlib
|
||||
{$ELSE}
|
||||
windows
|
||||
{$ENDIF}
|
||||
|
||||
;
|
||||
|
||||
type
|
||||
TMWindowSelector = class(TObject)
|
||||
constructor Create(aWindow: TMWindow);
|
||||
destructor Destroy; override;
|
||||
|
||||
{$IFDEF LINUX}
|
||||
function Drag: x.TWindow;
|
||||
{$ELSE}
|
||||
function Drag: Hwnd;
|
||||
{$ENDIF}
|
||||
|
||||
public
|
||||
Window: TMWindow;
|
||||
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
|
||||
constructor TMWindowSelector.Create(aWindow: TMWindow);
|
||||
begin
|
||||
inherited create;
|
||||
|
||||
Self.Window := aWindow;
|
||||
|
||||
end;
|
||||
|
||||
|
||||
destructor TMWindowSelector.Destroy;
|
||||
begin
|
||||
|
||||
inherited;
|
||||
end;
|
||||
|
||||
{$IFDEF LINUX}
|
||||
function TMWindowSelector.Drag: x.TWindow;
|
||||
var
|
||||
Tempwindow : x.TWindow;
|
||||
root : x.TWindow;
|
||||
subwindow : x.TWindow;
|
||||
x_root, y_root : cint;
|
||||
xmask : cuint;
|
||||
x, y : cint;
|
||||
Old_Handler : TXErrorHandler;
|
||||
|
||||
begin
|
||||
Old_Handler := XSetErrorHandler(@MufasaXErrorHandler);
|
||||
|
||||
Result := 0;
|
||||
|
||||
repeat
|
||||
XQueryPointer(Window.XDisplay, Window.DesktopWindow, @root,
|
||||
@Tempwindow, @x_root, @y_root,
|
||||
@x, @y, @xmask);
|
||||
subwindow:= Tempwindow;
|
||||
|
||||
while subwindow <> 0 do
|
||||
begin
|
||||
Tempwindow := subwindow;
|
||||
XQueryPointer(Window.XDisplay, Tempwindow, @root,
|
||||
@subwindow, @x_root, @y_root,
|
||||
@x, @y, @xmask);
|
||||
end;
|
||||
if Result <> Tempwindow then
|
||||
begin
|
||||
WriteLn('Changing Window to: ' + IntToStr(Tempwindow));
|
||||
Result := Tempwindow;
|
||||
end;
|
||||
|
||||
Sleep(16);
|
||||
|
||||
until (xmask and Button1Mask) = 0;
|
||||
|
||||
XSetErrorHandler(Old_handler);
|
||||
end;
|
||||
|
||||
{$ELSE}
|
||||
|
||||
function TMWindowSelector.Drag: Hwnd;
|
||||
var
|
||||
TargetRect: TRect;
|
||||
DC: HDC;
|
||||
OldPen, Pen: hPen;
|
||||
OldBrush : hBrush;
|
||||
BrushHandle : THandle;
|
||||
Cursor : TCursor;
|
||||
TempHandle : Hwnd;
|
||||
Handle : Hwnd;
|
||||
begin;
|
||||
Pen := CreatePen(PS_SOLID, GetSystemMetrics(SM_CXBORDER)*5, clred);
|
||||
BrushHandle := GetStockObject(Null_Brush);
|
||||
Cursor:= Screen.Cursor;
|
||||
Screen.Cursor:= crCross;
|
||||
TempHandle := GetDesktopWindow;
|
||||
while GetAsyncKeyState(VK_LBUTTON) <> 0 do
|
||||
begin;
|
||||
Handle:= WindowFromPoint(Mouse.CursorPos);
|
||||
if Handle <> TempHandle then
|
||||
begin;
|
||||
if TempHandle <> 0 then
|
||||
begin;
|
||||
Invalidaterect(temphandle, nil, true);
|
||||
UpdateWindow(temphandle);
|
||||
{$IFDEF MSWINDOWS}
|
||||
RedrawWindow(TempHandle, nil, 0, RDW_Frame or RDW_Invalidate or RDW_Updatenow or RDW_Allchildren);
|
||||
{$ENDIF}
|
||||
end;
|
||||
if Handle <> 0 then
|
||||
begin;
|
||||
GetWindowRect(Handle, TargetRect);
|
||||
DC := Windows.GetWindowDC(Handle);
|
||||
OldPen := SelectObject(DC, Pen);
|
||||
OldBrush := SelectObject(DC, BrushHandle);
|
||||
Rectangle(DC, 0, 0, TargetRect.Right - TargetRect.Left, TargetRect.Bottom - TargetRect.Top);
|
||||
SelectObject(DC, OldBrush);
|
||||
SelectObject(DC, OldPen);
|
||||
ReleaseDC(Handle, DC);
|
||||
end;
|
||||
TempHandle := Handle;
|
||||
end;
|
||||
Sleep(64);
|
||||
end;
|
||||
Result := TempHandle;
|
||||
Screen.Cursor:= cursor;
|
||||
Invalidaterect(temphandle, nil, true);
|
||||
UpdateWindow(temphandle);
|
||||
RedrawWindow(TempHandle, nil, 0, RDW_Frame or RDW_Invalidate or RDW_Updatenow or RDW_Allchildren);
|
||||
DeleteObject(Pen);
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
|
||||
|
||||
end.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user