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 » U++ Library support » TopWindow&PopUp, TrayIcon » Toggling between FullScreen and not
Toggling between FullScreen and not [message #14149] Fri, 15 February 2008 14:41 Go to next message
Tom1
Messages: 1212
Registered: March 2007
Senior Contributor
Hi,

I do not seem to be able to toggle the TopWindow between FullScreen and normal size. FullScreen works OK from the constructor of the TopWindow derived class, but not after that. Help, anybody?

// Tom

Re: Toggling between FullScreen and not [message #14153 is a reply to message #14149] Fri, 15 February 2008 16:20 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Tom1 wrote on Fri, 15 February 2008 08:41

Hi,

I do not seem to be able to toggle the TopWindow between FullScreen and normal size. FullScreen works OK from the constructor of the TopWindow derived class, but not after that. Help, anybody?

// Tom




I am afraid you will have to close it and open again after changing the flag.

E.g.:

#include <CtrlLib/CtrlLib.h>

using namespace Upp;

struct App : TopWindow {
	bool fullscreen;

	virtual void LeftDown(Point, dword) {
		Close();
		DUMP(IsOpen());
		FullScreen(fullscreen = !fullscreen);
		SetRect(100, 100, 400, 400);
		OpenMain();
	}
	
	App() { fullscreen = false; }
};

GUI_APP_MAIN
{
	App app;
	app.OpenMain();
	Ctrl::EventLoop();
}


Mirek
Re: Toggling between FullScreen and not [message #14154 is a reply to message #14153] Fri, 15 February 2008 17:01 Go to previous messageGo to next message
Tom1
Messages: 1212
Registered: March 2007
Senior Contributor
Thanks Mirek, that helped a lot. It is not that bad that I need to close the window temporarily this way since the application still keeps its state.

// Tom
Re: Toggling between FullScreen and not [message #14164 is a reply to message #14154] Sat, 16 February 2008 10:37 Go to previous messageGo to next message
Tom1
Messages: 1212
Registered: March 2007
Senior Contributor
In fullscreen mode on (K)ubuntu linux I'm not able to open pop-up menus nor dialogs. This really cuts down the usefulness of this feature. I read about this problem in another post here on the forum. Still I suspect there is some way to go around this in X11 since e.g. Mozilla Firefox does this beautifully (hotkey F11) allowing other windows to co-exist.

Does anybody know a way to make this happen?

// Tom
Re: Toggling between FullScreen and not [message #14202 is a reply to message #14164] Tue, 19 February 2008 23:44 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Tom1 wrote on Sat, 16 February 2008 04:37

In fullscreen mode on (K)ubuntu linux I'm not able to open pop-up menus nor dialogs. This really cuts down the usefulness of this feature. I read about this problem in another post here on the forum. Still I suspect there is some way to go around this in X11 since e.g. Mozilla Firefox does this beautifully (hotkey F11) allowing other windows to co-exist.

Does anybody know a way to make this happen?

// Tom


Which U++? There was improvement since 2007.1, but now I am not sure whether it was win32 only... (but in win32, it works).

Mirek
Re: Toggling between FullScreen and not [message #14350 is a reply to message #14202] Sat, 23 February 2008 11:08 Go to previous messageGo to next message
Tom1
Messages: 1212
Registered: March 2007
Senior Contributor
2008.1beta. And yes, I agree it works on Windows very well indeed, but on X11 it does not.

// Tom
Re: Toggling between FullScreen and not [message #14464 is a reply to message #14350] Wed, 27 February 2008 00:29 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
I have just tested with X11, seems to be OK...

Maybe try with latest .deb...

http://www.ultimatepp.org/svnbuilds/upp-svn_SVN.165_i386.deb

Mirek

[Updated on: Wed, 27 February 2008 00:30]

Report message to a moderator

Re: Toggling between FullScreen and not [message #14481 is a reply to message #14464] Wed, 27 February 2008 10:29 Go to previous messageGo to next message
Tom1
Messages: 1212
Registered: March 2007
Senior Contributor
I downloaded the upp-svn_SVN.165_i386.deb, but had no luck. Note that going to the fullscreen and back to normal size is not the problem but opening a context menu while in fullscreen mode is. I.e. the context menu does not pop up when in fullscreen mode although the context menu works correctly when window is in its normal size.

// Tom
Re: Toggling between FullScreen and not [message #14485 is a reply to message #14481] Wed, 27 February 2008 10:46 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Tom1 wrote on Wed, 27 February 2008 04:29

I downloaded the upp-svn_SVN.165_i386.deb, but had no luck. Note that going to the fullscreen and back to normal size is not the problem but opening a context menu while in fullscreen mode is. I.e. the context menu does not pop up when in fullscreen mode although the context menu works correctly when window is in its normal size.

// Tom


I am sorry, I have missed the part about popup... Sad

Mirek
Re: Toggling between FullScreen and not [message #14491 is a reply to message #14485] Wed, 27 February 2008 12:49 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Tom1 wrote on Wed, 27 February 2008 04:29

I downloaded the upp-svn_SVN.165_i386.deb, but had no luck. Note that going to the fullscreen and back to normal size is not the problem but opening a context menu while in fullscreen mode is. I.e. the context menu does not pop up when in fullscreen mode although the context menu works correctly when window is in its normal size.

// Tom


Well, after some investigation, I have fixed all X11 issues by changing the fullscreen implementation from popup to using _NET_WM_STATE_FULLSCREEN.

Now it seems to work much better Smile

Please try:

void TopWindow::SyncCaption()
{
	LLOG("SyncCaption");
	SyncTitle();
	if(IsOpen() && GetWindow()) {
		unsigned long wina[6];
		int n = 0;
		Window w = GetWindow();
		if(tool)
			wina[n++] = XAtom("_NET_WM_WINDOW_TYPE_TOOLBAR");
		if(GetOwner())
			wina[n++] = XAtom("_NET_WM_WINDOW_TYPE_DIALOG");
		wina[n++] = XAtom("_NET_WM_WINDOW_TYPE_NORMAL");
		XChangeProperty(Xdisplay, GetWindow(), XAtom("_NET_WM_WINDOW_TYPE"), XAtom("ATOM"), 32,
		                PropModeReplace, (const unsigned char *)wina, n);
		n = 0;
		if(topmost)
			wina[n++] = XAtom("_NET_WM_STATE_ABOVE");
		if(state == MAXIMIZED) {
			wina[n++] = XAtom("_NET_WM_STATE_MAXIMIZED_HORZ");
			wina[n++] = XAtom("_NET_WM_STATE_MAXIMIZED_VERT");
		}
		if(fullscreen)
			wina[n++] = XAtom("_NET_WM_STATE_FULLSCREEN");
		XChangeProperty(Xdisplay, GetWindow(), XAtom("_NET_WM_STATE"), XAtom("ATOM"), 32,
		                PropModeReplace, (const unsigned char *)wina, n);
		wm_hints->flags = InputHint|WindowGroupHint|StateHint;
		wm_hints->initial_state = NormalState;
		wm_hints->input = XTrue;
		Ctrl *owner = GetOwner();
		wm_hints->window_group = owner ? owner->GetWindow() : w;
		if(!icon.IsEmpty()) {
			Size isz = icon.GetSize();
			int len = 2 + isz.cx * isz.cy;
			Buffer<unsigned long> data(len);
			unsigned long *t = data;
			*t++ = isz.cx;
			*t++ = isz.cy;
			for(int y = 0; y < isz.cy; y++) {
				const RGBA *q = icon[y];
				for(int x = isz.cx; x--;) {
					*t++ = ((dword)q->a << 24) |
					       (dword)q->b | ((dword)q->g << 8) | ((dword)q->r << 16);
					q++;
				}
			}
			XChangeProperty(Xdisplay, w, XAtom("_NET_WM_ICON"), XA_CARDINAL, 32, PropModeReplace,
			                (const unsigned char *)~data, len);
		}
		XSetWMHints(Xdisplay, w, wm_hints);
	}
}

void TopWindow::Open(Ctrl *owner)
{
	if(dokeys && (!GUI_AKD_Conservative() || GetAccessKeysDeep() <= 1))
		DistributeAccessKeys();
	UsrLogT(3, "OPEN " + Desc(this));
	LLOG("OPEN " << Name() << " owner: " << UPP::Name(owner));
	IgnoreMouseUp();
	if(fullscreen)
		SetRect(0, 0, Xwidth, Xheight);
	else
		CenterRect(owner);
	LLOG("Open NextRequest " << NextRequest(Xdisplay));
	Create(owner, false, false);
	xminsize.cx = xmaxsize.cx = Null;
	title2.Clear();
	LLOG("SyncCaption");
	SyncCaption();
	LLOG("SyncSizeHints");
	size_hints->flags = 0;
	SyncSizeHints();
	Rect r = GetRect();
	size_hints->x = r.left;
	size_hints->y = r.top;
	size_hints->width = r.Width();
	size_hints->height = r.Height();
	size_hints->win_gravity = StaticGravity;
	size_hints->flags |= PPosition|PSize|PWinGravity;
	if(owner) {
		ASSERT(owner->IsOpen());
		LLOG("XSetTransientForHint");
		XSetTransientForHint(Xdisplay, GetWindow(), owner->GetWindow());
	}
	LLOG("XSetWMNormalHints");
	XSetWMNormalHints(Xdisplay, GetWindow(), size_hints);
	Atom protocols[2];
	protocols[0] = XAtom("WM_DELETE_WINDOW");
	protocols[1] = XAtom("WM_TAKE_FOCUS");
	LLOG("XSetWMProtocols");
	XSetWMProtocols(Xdisplay, GetWindow(), protocols, 2);
	String x = GetExeTitle().ToString();
	const char *progname = ~x;
	class_hint->res_name = (char *)progname;
	class_hint->res_class = (char *)progname;
	XSetClassHint(Xdisplay, GetWindow(), class_hint);
	LLOG("WndShow(" << visible << ")");
	WndShow(visible);
	if(visible) {
		XEvent e;
		LLOG("XWindowEvent");
		XWindowEvent(Xdisplay, top->window, VisibilityChangeMask, &e);
		ignoretakefocus = true;
		SetTimeCallback(500, THISBACK(EndIgnoreTakeFocus));
		LLOG("SetWndFocus");
		SetWndFocus();
		for(int i = 0; i < 50; i++) {
			if(XCheckTypedWindowEvent(Xdisplay, top->window, FocusIn, &e)) {
				ProcessEvent(&e);
				if(e.xfocus.window = top->window)
					break;
			}
			Sleep(10);
		}
	}
	LLOG(">Open NextRequest " << NextRequest(Xdisplay));
	LLOG(">OPENED " << Name());
	PlaceFocus();
	StateH(OPEN);
	Vector<int> fe = GetPropertyInts(top->window, XAtom("_NET_FRAME_EXTENTS"));
	if(fe.GetCount() >= 4 &&
	   fe[0] >= 0 && fe[0] <= 16 && fe[1] >= 0 && fe[1] <= 16 && //fluxbox returns wrong numbers - quick&dirty workaround
	   fe[2] >= 0 && fe[2] <= 64 && fe[3] >= 0 && fe[3] <= 48)
	{
		windowFrameMargin.left = max(windowFrameMargin.left, fe[0]);
		windowFrameMargin.right = max(windowFrameMargin.right, fe[1]);
		windowFrameMargin.top = max(windowFrameMargin.top, fe[2]);
		windowFrameMargin.bottom = max(windowFrameMargin.bottom, fe[3]);
	}
	if(IsOpen() && top)
		top->owner = owner;

	int version = 5;
	XChangeProperty(Xdisplay, GetWindow(), XAtom("XdndAware"), XA_ATOM, 32,
					0, (byte *)&version, 1);
	FixIcons();
}


Mirek
Re: Toggling between FullScreen and not [message #14496 is a reply to message #14491] Wed, 27 February 2008 14:36 Go to previous messageGo to next message
Tom1
Messages: 1212
Registered: March 2007
Senior Contributor
Thanks Mirek, it is much better now!

I do not know if this is critical to users, but at least in KDE the task bar still remains visible on screen when the application is in the fullscreen mode. Is it possible to get all of the screen covered with the fullscreen mode?

// Tom
Re: Toggling between FullScreen and not [message #14504 is a reply to message #14496] Wed, 27 February 2008 19:16 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Tom1 wrote on Wed, 27 February 2008 08:36

Thanks Mirek, it is much better now!

I do not know if this is critical to users, but at least in KDE the task bar still remains visible on screen when the application is in the fullscreen mode. Is it possible to get all of the screen covered with the fullscreen mode?

// Tom


Not sure. Basically, using "_NET_WM_STATE_FULLSCREEN" I am telling KDE WM to run application in fullscreen. If it does not want to do so, then IMO not much more can be done.

OTOH, you can try to google this situation... Perhaps you can come with some fix. With Gnome/Metacity, it seems to work OK.

Mirek
Re: Toggling between FullScreen and not [message #14508 is a reply to message #14504] Wed, 27 February 2008 23:16 Go to previous messageGo to next message
guido is currently offline  guido
Messages: 169
Registered: April 2006
Experienced Member
Well, there where ways to indicate fs before freedesktop.org.
I'm not into that stuff anymore, but I can look it up.
Will add 50 bytes to Linux binaries by estimate.
I guess <5% of Linux install are affected. That number will go down only as Linux grows, not in absolute numbers, as people using those WMs fiercly resist change Very Happy

Sorry, KDE ist affected. I should learn to read Very Happy
I think I know what might be up. Looking into it...

[Updated on: Wed, 27 February 2008 23:29]

Report message to a moderator

Re: Toggling between FullScreen and not [message #14511 is a reply to message #14504] Wed, 27 February 2008 23:57 Go to previous messageGo to next message
guido is currently offline  guido
Messages: 169
Registered: April 2006
Experienced Member
What does upp use Ctrl::GetPrimaryWorkArea() for?
If those values where used for the fs window, that would explain it.
Re: Toggling between FullScreen and not [message #14515 is a reply to message #14511] Thu, 28 February 2008 10:16 Go to previous message
Tom1
Messages: 1212
Registered: March 2007
Senior Contributor
Just noticed an interesting feature: on KDE (both 3.5.8 and 4) the system menu selection Advanced->Fullscreen gives a complete full screen view for an application window regardless if the application supports fullscreen mode or not. This certainly puts the application in fullscreen mode at will but obviously it would be nice to have the application's fullscreen feature to toggle the window managers fullscreen setting. I guess KDE is not playing the game the same way as Gnome.

// Tom
Previous Topic: Linux TrayIcon menu improvement
Next Topic: How to get and set window placement information?
Goto Forum:
  


Current Time: Thu Mar 28 19:36:01 CET 2024

Total time taken to generate the page: 0.01022 seconds