faiface/pixel

Full screen to cover the top bar on mac?

Opened this issue · 7 comments

I am making a program that can draw squares over other applications like this

https://i.gyazo.com/1c6dc75ce135d6ffb3a64242a2065c5a.gif

But I can't seem to draw on top of the top bar on mac, is there a setting that allows this?

My full code can be found here: https://github.com/markustenghamn/mousedraw

By changing the config I am able to draw on top of the top bar but my monitor goes black when i start and exit the application.

cfg := pixelgl.WindowConfig{
		Bounds:                 pixel.R(0, 0, monitorX, monitorY),
		Undecorated:            true,
		TransparentFramebuffer: true,
		Monitor: pixelgl.PrimaryMonitor(),
	}

What happens if you remove the 'Monitor' option and add the 'Maximized=true' option?

What happens if you remove the 'Monitor' option and add the 'Maximized=true' option?

784792332ba91032a228c3b422fdcc6c

Unfortunately it's the same issue. This is the config:

cfg := pixelgl.WindowConfig{
		Bounds:                 pixel.R(0, 0, monitorX, monitorY),
		Undecorated:            true,
		TransparentFramebuffer: true,
		Maximized: true,
	}

I think (I have no proof except for using a mac over the years) that unless your application is truly fullscreen (where the monitor flashes), I don't think you can draw over the menubar. I can't think of a non-fullscreen application that can. I'll continue to poke around the googles to see if this is true.

@dusk125 I use Gyazo (https://gyazo.com/) for screenshots and it's able to draw over the menubar without flashing and I wanted to replicate this behaviour in go and had hoped that it was simple enough to do with pixel but it seems that it may be much more complicated than that I guess.

And there's the proof ;) Yeah might be, out of curiousity, what are the values of your monitorX and monitorY and do they match the actual height and width of the monitor. My thought is that macos is giving you back a truncated height from the opengl primarymonitor size function.

I'm using a MacBook Pro (15-inch, 2018) with a 15,4-inch retina display (2880 × 1800)

  • monitorX, monitorY = 1680, 1050
  • moving my mouse to the very top of the monitor on top of the bar has win.mousePosition() as Vec(831.770751953125, 1050).
  • If I draw a rectangle the min and max still shows vectors where the bar is located on the screen but it's like the rectangle is under the bar or not able to render on top of it. The rect.Min, rect.Max are Vec(962.74609375, 899.3773345947266) Vec(780.1214599609375, 1050). As shown in the picture:

360a4f9451989c039ed0bfc763a6dfd7

edit: just to clarify, the y coordinate is less than 1050 in the middle of the bar or right under the bar.