Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » FullScreen: why does not work?
Toggle FullScreen on X11 [message #30297 is a reply to message #30055] Wed, 22 December 2010 12:54 Go to previous messageGo to previous message
oan1971 is currently offline  oan1971
Messages: 7
Registered: April 2010
Promising Member
Hello Koldo,

I am no X11 expert at all, but the following seems to work on Linux. I guess that the window manager needs to support "Extended Window Manager Hints" (see http://standards.freedesktop.org/wm-spec/wm-spec-latest.html #id2551694).

#include <CtrlLib/CtrlLib.h>

using namespace Upp;

class FullScreenTest : public TopWindow
{
public:
	typedef FullScreenTest CLASSNAME;
	FullScreenTest();
	virtual bool Key(dword key, int count);
	virtual void Paint(Draw& w);
	void SetFullScreen(bool b);
};

FullScreenTest::FullScreenTest()
{
	Title("FullScreenTest").Sizeable();
}

void FullScreenTest::Paint(Draw & w)
{
	Rect r = GetView();
	w.DrawRect(r, Blue);
}

bool FullScreenTest::Key(dword key, int count)
{
	if (key == K_F11)
		if (IsFullScreen())
			SetFullScreen(false);
		else
			SetFullScreen(true);
}

void FullScreenTest::SetFullScreen(bool b)
{
	Sizeable(!b);
	FullScreen(b);
	
	XEvent event;
	event.xclient.type = ClientMessage;
	event.xclient.serial = 0;
	event.xclient.send_event = true;
	event.xclient.message_type = XAtom("_NET_WM_STATE");
	event.xclient.window = GetWindow();
	event.xclient.format = 32;
	event.xclient.data.l[0] = b;
	event.xclient.data.l[1] = XAtom("_NET_WM_STATE_FULLSCREEN");
	event.xclient.data.l[2] = 0;
	event.xclient.data.l[3] = 0;
	event.xclient.data.l[4] = 0;
	
	XSendEvent(Xdisplay, Xroot, false, SubstructureRedirectMask | SubstructureNotifyMask, &event);
	
	if (b)
		SetRect(0, 0, Xwidth, Xheight);
}

GUI_APP_MAIN
{
	FullScreenTest().Run();
}


Best regards,
Oliver


910eb20c14e026a87ffb2b0d38b9ddb7
 
Read Message
Read Message
Read Message icon1.gif
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Any tuple examples?
Next Topic: Multiple users over LAN
Goto Forum:
  


Current Time: Sun Aug 24 06:53:35 CEST 2025

Total time taken to generate the page: 0.04142 seconds