Page 1 of 1

Flicker free window resize to minimum width/height - OSX

Posted: Sun Mar 19, 2017 12:09 pm
by HarrysLad
This seems to have been asked before but I still can't find an answer.
It all works fine on Windows - the mouse cursor simply goes into the minimally-resized window and redrawing stops. With OSX though, the window resizes to the cursor and out to it's minimum size again - hence the flicker.
Any ideas or solutions would be very welcome.

While I'm here ... :)
I once found a method on this forum to set the mouse position but I can't seem to find it now.
Again, if someone could be so kind ...

Dave

Re: Flicker free window resize to minimum width/height - OSX

Posted: Fri Mar 31, 2017 8:31 am
by deseven

Code: Select all

OpenWindow(0,#PB_Ignore,#PB_Ignore,400,300,"WindowBounds",#PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_ScreenCentered)
WindowBounds(0,300,200,500,400)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
Otherwise you can use cocoa minSize/maxSize or window callback.

Re: Flicker free window resize to minimum width/height - OSX

Posted: Wed Apr 05, 2017 11:12 pm
by HarrysLad
Thanks for the reply. WindowBounds() eh? I don't know how I missed that. :oops:
Any clue on the mouse position (OSX) thing?

Dave

Re: Flicker free window resize to minimum width/height - OSX

Posted: Thu Apr 06, 2017 11:40 am
by deseven
Like that?

Code: Select all

ImportC ""
  CGWarpMouseCursorPosition(x.CGFloat,y.CGFloat)
EndImport

OpenWindow(0,#PB_Ignore,#PB_Ignore,400,300,"cursor movement",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
ButtonGadget(0,10,10,200,30,"Move cursor to center")
ButtonGadget(1,190,260,200,30,"Move cursor to center")

Repeat
  ev = WaitWindowEvent()
  If ev = #PB_Event_Gadget
    CGWarpMouseCursorPosition(WindowX(0,#PB_Window_InnerCoordinate)+200,WindowY(0,#PB_Window_InnerCoordinate)+150)
  EndIf
Until ev = #PB_Event_CloseWindow