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 » Extra libraries, Code snippets, applications etc. » OS Problems etc., Win32, POSIX, MacOS, FreeBSD, X11 etc » function TopWindow::Maximize does not work in linux.
function TopWindow::Maximize does not work in linux. [message #6105] Mon, 30 October 2006 20:41 Go to previous message
nicomesas is currently offline  nicomesas
Messages: 104
Registered: September 2006
Location: Barcelona, Spain
Experienced Member
One first approach to solve this failure could be this.
void TopWindow::Maximize(bool effect)
{
  state = MAXIMIZED;
  // new lines added
  Rect r = Ctrl::GetWorkArea() ;
  SetFrameRect(r) ;
}

The problem to use this is that the window occupies all the screen available but its state is not maximized.

In order to be able to put the window in maximized way it is necessary to use a code like this
static void net_wm_state(const Ctrl* w, bool set, Atom one, Atom two = 0)
{

  XEvent e;
  e.xclient.type = ClientMessage;
  e.xclient.message_type = XAtom("_NET_WM_STATE");
  e.xclient.display = Xdisplay;
  e.xclient.window = w->GetWindow();
  e.xclient.format = 32;
  e.xclient.data.l[0] = set ? 1 : 0;
  e.xclient.data.l[1] = one;
  e.xclient.data.l[2] = two;
  e.xclient.data.l[3] = 0;
  e.xclient.data.l[4] = 0;
  XSendEvent(Xdisplay, Xroot, false, (SubstructureNotifyMask | SubstructureRedirectMask), &e);
}
void TopWindow::Maximize(bool effect)
{
  state = MAXIMIZED;
  net_wm_state(this, effect,
     XAtom("_NET_WM_STATE_MAXIMIZED_HORZ"),
     XAtom("_NET_WM_STATE_MAXIMIZED_VERT") ) ;
}

The bad thing of this code is that it requires that the X11 window exists... Good this is what I deduce nevertheless, because if I call this code in the constructor of my TopWindow does not do anything, but if I call it when the window already is, if that works well.

I had thought that in X11 something like the Windows WM_CREATE message would. I belivied there was a ok place to do the maximize operation, but believe that my little knowledge of X11 do not give for more. Confused

[Updated on: Mon, 30 October 2006 21:45] by Moderator

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Previous Topic: plugin/sqlite3 case sensitive name on linux
Next Topic: Dynamic library load works rare in Linux
Goto Forum:
  


Current Time: Thu Mar 28 13:18:12 CET 2024

Total time taken to generate the page: 0.00838 seconds