[GB.DESKTOP]

* BUG: DesktopWindow.X and Desktop.Y now return the correct window 
  position, provided that the window manager follows the EWMH freedesktop
  standard of course.


git-svn-id: svn://localhost/gambas/trunk@5173 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2012-09-17 14:22:26 +00:00
parent 22a119f0a6
commit cbad814159
5 changed files with 46 additions and 16 deletions

View file

@ -599,6 +599,21 @@ BEGIN_METHOD(CDESKTOP_minimize_window, GB_INTEGER window; GB_BOOLEAN minimized)
END_METHOD
BEGIN_METHOD_VOID(Desktop_Flush)
XFlush(X11_display);
END_METHOD
BEGIN_METHOD_VOID(Desktop_Sync)
XSync(X11_display, FALSE);
END_METHOD
GB_DESC CDesktopDesc[] =
{
GB_DECLARE("_Desktop", 0), GB_VIRTUAL_CLASS(),
@ -623,6 +638,8 @@ GB_DESC CDesktopDesc[] =
GB_STATIC_METHOD("GetWindowGeometry", "Integer[]", CDESKTOP_get_window_geometry, "(Window)i"),
GB_STATIC_METHOD("MakeIcon", "Image", CDESKTOP_make_icon, "(Data)Array;[(Width)i(Height)h]"),
GB_STATIC_METHOD("MinimizeWindow", NULL, CDESKTOP_minimize_window, "(Window)i(Minimized)b"),
GB_STATIC_METHOD("Sync", NULL, Desktop_Sync, NULL),
GB_STATIC_METHOD("Flush", NULL, Desktop_Flush, NULL),
GB_END_DECLARE
};

View file

@ -210,10 +210,18 @@ Width
r
i
W
r
i
Height
r
i
H
r
i
Name
r
s

View file

@ -27,13 +27,13 @@ SearchString=True
File[1]=".src/Desktop.class:219.24"
File[2]=".src/DesktopWatcher.class:70.2"
File[3]=".src/DesktopFile.class:296.7"
File[4]=".src/Main.module:154.16"
File[4]=".src/Main.module:147.12"
File[5]=".src/_DesktopIcons.class:16.0"
Active=6
File[6]=".src/DesktopWindow.class:20.0"
File[6]=".src/DesktopWindow.class:87.34"
File[7]=".src/Form1.class:14.0"
File[8]=".src/Form1.form"
File[9]=".src/Atom.class:10.0"
File[9]=".src/Atom.class:10.43"
Count=9
[Watches]

View file

@ -4,8 +4,8 @@ Export
Property Read X As Integer
Property Read Y As Integer
Property Read Width As Integer
Property Read Height As Integer
Property Read Width, W As Integer
Property Read Height, H As Integer
Property Read Name As String
Property Read VisibleName As String
Property Desktop As Integer
@ -37,7 +37,14 @@ End
Private Sub GetDimensions()
If Not $aDim Then $aDim = _Desktop.GetWindowGeometry($iId)
Dim aExt As Integer[]
If Not $aDim Then
$aDim = _Desktop.GetWindowGeometry($iId)
aExt = _Desktop.GetWindowProperty(Atom["_NET_FRAME_EXTENTS"], $iId)
$aDim[0] -= aExt[0]
$aDim[1] -= aExt[2]
Endif
End
@ -83,12 +90,16 @@ Public Sub Move(X As Integer, Y As Integer, Optional Width As Integer, Optional
Else
_Desktop.SendClientMessageToRootWindow(Atom["_NET_MOVERESIZE_WINDOW"], [&X10001100000000, X, Y], $iId)
Endif
_Desktop.Flush
Refresh
End
Public Sub Resize(Width As Integer, Height As Integer)
_Desktop.SendClientMessageToRootWindow(Atom["_NET_MOVERESIZE_WINDOW"], [&X10110000000000, Width, Height], $iId)
_Desktop.Flush
Refresh
End

View file

@ -139,21 +139,15 @@ End
Public Sub Main()
' Dim hWindow As DesktopWindow
'
' 'Print Desktop.Path
'
' For Each hWindow In Desktop.Windows
' Print Hex$(hWindow.Id, 8);; Quote(hWindow.Name); ": "; hWindow.X;; hWindow.Y;; hWindow.Height;; hWindow.Width
' Next
Dim aWin As Integer[]
Dim hWin As DesktopWindow
For Each hWin In Desktop.Windows
'Print hWin.VisibleName
If hWin.VisibleName Like "gambas3 3.3.0 - *" Then
hWin.Maximized = True
'hWin.Move(200, 100, 800, 500)
Print hWin.X;; hWin.Y;; hWin.Width;; hWin.Height
hWin.Move(200, 100, 800, 500)
hWin.Refresh
Print hWin.X;; hWin.Y;; hWin.Width;; hWin.Height
Endif
Next