Skip to content

Commit

Permalink
Use another way to make sure the form appears in the wanted position
Browse files Browse the repository at this point in the history
Reverts 323dacb which was wrong anyway
because it did not calculate the current screen.
  • Loading branch information
kokoko3k committed Nov 2, 2016
1 parent 4403aa3 commit 292c0bc
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 10 deletions.
17 changes: 15 additions & 2 deletions .settings
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ Geometry=[61,307,224,280]
[DebugWindow/GridIndex.Rows[GridIndex.row]]
Geometry=[45,-3,224,280]

[DebugWindow/Image.Load("ShapeNull.png").Resize(fmain.w, fmain.h).picture]
Geometry=[52,0,224,280]

[DebugWindow/Image.Load("ShapeNull.png").Resize(fmain.w, fmain.h).picture.Image]
Geometry=[66,14,224,280]

[DebugWindow/Label]
Geometry=[45,-3,224,280]

Expand All @@ -107,6 +113,9 @@ Geometry=[1280,-3,224,280]
[DebugWindow/Object]
Geometry=[45,-3,224,280]

[DebugWindow/Picture["appicon.png"]]
Geometry=[52,0,224,280]

[DebugWindow/Picture["icon:|" & rSize & "|directory"]]
Geometry=[1280,0,224,280]

Expand Down Expand Up @@ -443,6 +452,9 @@ Geometry=[47,-3,229,280]
[DebugWindow/selectable]
Geometry=[1280,0,224,280]

[DebugWindow/shadowimage]
Geometry=[52,0,224,280]

[DebugWindow/sizes]
Geometry=[47,-3,224,280]

Expand Down Expand Up @@ -480,12 +492,12 @@ Path="/tmp/higgins.gambas"
File[1]="higgins.desktop:18.7"
Active=7
File[2]=".src/MySettings.module:0.8"
Count=15
Count=16
File[3]=".src/plugins/plugin_apps_gui.form"
File[4]=".src/plugins/plugin_indexer_gui.form"
File[5]=".src/plugins/plugin_015_recent.class:0.19"
File[6]=".src/FMain.form"
File[7]=".src/FMain.class:0.1489"
File[7]=".src/FMain.class:0.1629"
File[8]=".src/hSettings.class:14.258"
File[9]=".src/Global.module:34.92"
File[10]=".src/MyDesktop.class:3.60"
Expand All @@ -494,6 +506,7 @@ File[12]=".src/hSettings.form"
File[13]=".src/StartClass.class:18.3"
File[14]=".src/plugins/plugin_020_apps.class:0.63"
File[15]=".src/DesktopApps.class:10.86"
File[16]=".src/gstyle.module:28.180"

[Watches]
Count=0
Expand Down
2 changes: 1 addition & 1 deletion .src/DesktopApps.class
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Static Public Sub WarmCache()


For Each sPath In anotherdirs
Debug "Warming norecursiv:e " & sPath
Debug "Warming norecursive " & sPath
WarmList &= sPath & " "
Next

Expand Down
77 changes: 72 additions & 5 deletions .src/FMain.class
Original file line number Diff line number Diff line change
Expand Up @@ -1268,9 +1268,9 @@ Public Sub Form_KeyRelease()
End

Public Sub Form_Hide()
Dim timer_hidden As New Timer As "timer_hidden"
resultgrid.visible = False 'act a s a control on show time to force minimum height
Wait
MySettings.save_geometry()
ResultGrid.UnSelectAll()
resultgrid.row = -1
Try timer_expand_check.stop
Expand All @@ -1283,13 +1283,22 @@ Public Sub Form_Hide()
textbox1.Clear
textbox1.text = ""
Endif
timer_hidden.delay = 10
timer_hidden.start
End

Public Sub timer_hidden_timer()
timer_hidden.stop
fmain.border = True
End


Public OLD_timer_shown As Timer
Public timer_hidden As Timer
Public timer_shown As Timer
Public iterations As Integer

Public Sub timer_shown_timer()
Public Sub OLD_timer_shown_timer()
'brute force needed for kwin + qt5
'...the window sometimes appears at wrong position
'..so hammer it with a timer to restore the right one.
Expand Down Expand Up @@ -1318,7 +1327,7 @@ Public Sub timer_shown_timer()
Endif
End

Public Sub Form_Show()
Public Sub OLD_Form_Show()
Dim decorated As Boolean = hsettings.CheckBox1.value <> CheckBox.true
fmain.border = decorated

Expand All @@ -1339,6 +1348,58 @@ Public Sub Form_Show()
End


Public Sub Form_Show()
Dim iMask As New Image
Dim decorated As Boolean = hsettings.CheckBox1.value <> CheckBox.true

If Not decorated Then
'invisible 'use a blank mask to hide the form until we are sure it is displayed in the right position.
iMask.Resize(fmain.w + 10, fmain.H + 10)
iMask.Fill(Color.Transparent)
Paint.Begin(iMask)
Paint.FillRect(iMask.w - 1, iMask.h - 1, 1, 1, Color.white)
Paint.end
fmain.mask = True
fmain.picture = iMask.Picture
global.object_unlock(TextBox1) '<--?? needed?
Endif

timer_shown = New Timer As "timer_shown"
timer_shown.trigger

End


Public Sub timer_shown_timer()
'Needed for kwin + qt5
'...the window sometimes appears at wrong position
'..so hammer it with a timer to restore the right one.

Dim decorated As Boolean = hsettings.CheckBox1.value <> CheckBox.true
Dim i As Integer
Dim right_geom As Collection
fmain.tag = ""
resize_form()
gstyle.make_background()
TextBox1.SetFocus()
fmain.Border = decorated

right_geom = MySettings.load_geometry()

If Not decorated Then
Wait
If (fmain.screeny <> right_geom["y"]) Or (fmain.screeny <> fmain.y) Then
For i = 0 To 30
Debug fmain.screeny, right_geom["y"]
MySettings.load_geometry()
Wait 0.01
If (fmain.screeny = right_geom["y"]) And (fmain.screeny = fmain.y) Then Break
Next
Endif
Endif
fmain.mask = False
fmain.picture = Null
End



Expand Down Expand Up @@ -1458,7 +1519,7 @@ End


Public Sub Form_Leave()

MySettings.save_geometry()
MySettings.save()

End
Expand Down Expand Up @@ -1522,6 +1583,7 @@ Public Sub panel2_MouseDown()
End

Public bRresize As Boolean = False
Public bRMove As Boolean = False

Public Sub panel2_mousemove()
Dim bResize As Boolean
Expand All @@ -1546,13 +1608,18 @@ Public Sub panel2_mousemove()
mouse_startx = Mouse.x
mouse_starty = Mouse.y
Else
bRMove = True
Me.Move(fmain.x + (mouse.x - mouse_StartX), fmain.y + (mouse.y - mouse_Starty))
Endif
End


Public Sub panel2_Mouseup()
bRresize = False
If bRresize = True Or (bRMove = True) Then
MySettings.save_geometry()
bRresize = False
bRMove = False
Endif
End


Expand Down
10 changes: 8 additions & 2 deletions .src/MySettings.module
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,24 @@ Public Sub save_geometry()

Settings["win_rx"] = xy_r[0]
Settings["win_ry"] = xy_r[1]
If xy_r[1] = 28 Then Stop
Settings["win_w"] = xy_r[2]
End

Public Sub load_geometry()
Public Sub load_geometry(Optional pretend As Boolean = False) As Collection
Dim s As Screen
Dim rx, ry, w As Integer
Dim geom As New Collection
s = Screenbypos(Mouse.ScreenX, Mouse.ScreenY)
rx = Settings["win_rx", 0]
ry = Settings["win_ry", 0]
w = Settings["win_w", (s.w Div 2)]
' h = Settings["win_h", 64]
fmain.Move(rx + s.x, ry + s.y, w)
If Not pretend Then fmain.Move(rx + s.x, ry + s.y, w)
geom["x"] = rx + s.x
geom["y"] = ry + s.y
geom["w"] = w
Return geom
End


Expand Down
6 changes: 6 additions & 0 deletions .src/StartClass.class
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,10 @@

Static Public Sub Main()
FMain.first_init()
' While 1 = 1
' fmain.Show()
' Wait
' fmain.hide()
' Wait
' Wend
End

0 comments on commit 292c0bc

Please sign in to comment.