MacArthur, Ian (SELEX GALILEO, UK) wrote: > >> However, if the app is maximised, then then the app is >> started, it is sized >> correctly (in a way I guess) but not in maximised mode. >> >> Currently, I examine the window's dimensions and compare them against >> Fl::w() and Fl::h(). If either the window's width or height >> matches Fl::w() >> or Fl::h() (respectively), then I assume it's maximised. This >> is flawed on >> so many levels. >> >> There must be a better way? > > I did pretty much what you describe a while back. I don't know a better > way, but can't help feeling there ought to be. > > >> Also, is there a way to "ask" the window manager to start the >> app maximised? > > I think that varies a lot from platform to platform, and I don't think > fltk has a wrapper for that mechanism. Be nice if it did! > > Sorry,
Thanks. I did some more googling and managed to rework a fullscreen operation into a maximise operation. I haven't done any Xlib programming (outside of FLTK's Fl_x.cxx) before, so I may be wrong. Here's the X code that I've tested. It properly maximises the Fl_Window so that the maximise/restore icon on the border is set to "restore". Note that 'wnd' is the Fl_Window. ---8<------ Window xid = fl_xid(wnd); XEvent xev; Atom wm_state = XInternAtom(fl_display, "_NET_WM_STATE", False); Atom vmax = XInternAtom(fl_display, "_NET_WM_STATE_MAXIMIZED_VERT", False); Atom hmax = XInternAtom(fl_display, "_NET_WM_STATE_MAXIMIZED_HORZ", False); memset(&xev, 0, sizeof(xev)); xev.type = ClientMessage; xev.xclient.window = xid; xev.xclient.message_type = wm_state; xev.xclient.format = 32; xev.xclient.data.l[0] = 2; xev.xclient.data.l[1] = hmax; xev.xclient.data.l[2] = vmax; XSendEvent(fl_display, DefaultRootWindow(fl_display), False, SubstructureNotifyMask, &xev); --->8------ I just need to figure out how to determine if the window is already maximised :) Oh, and how to "restore" the window as well. -- Alvin _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

