Bug 1188 - NEWT: Window: Support non-resizable, minimize, maximize, alwaysOnBottom and sticky/all-desktop where supported
Summary: NEWT: Window: Support non-resizable, minimize, maximize, alwaysOnBottom and s...
Alias: None
Product: Newt
Classification: JogAmp
Component: core (show other bugs)
Version: 2.3.2
Hardware: All all
: --- enhancement
Assignee: Sven Gothel
: 637 (view as bug list)
Depends on: 637 1186
Blocks: 1208 1209 1214 1222
  Show dependency treegraph
Reported: 2015-08-10 15:49 CEST by Sven Gothel
Modified: 2015-09-27 03:24 CEST (History)
6 users (show)

See Also:
SCM Refs:
2d837a7a7130702ad36b694875613fae77c7ef06 4a9f65b176d618a8816eff6d24e683c56a4d8086 9ad7f6d6ffe975dc0a10dac159b8de32773e1da1 3ac9eca843d119902a65fdeee5456d204fbabfa4 bb4e7c5d3e13d91810a7530d6ffa0a909fdfc233 2c23b1cb343a008621e3fe642c5b8abacca48b1a 23d8cbd413ac6aca737d7a7d062c8bb6f5ac1ca5 56f03908e476a4630d36282592e12bf20e589fa8 026ea7ed280bf4eb3a0e3c8434e5d993121f3eb4 417546510a93de533562b631caa4a75feeecd793 1d71a21d9d1da21c555207d30d202f724ae269f2 725e9acfcdd0e16a3533d097692a912383bae3fc 522fe5ac2ef057286e4cbfa170aa4292c4ffed2d cc00d9b6c5a5c6b71ba14311fc6b17ce932d9a1e fa3c55b8176b284752ed14a5a24f7fee36e588a3
Workaround: ---


Note You need to log in before you can comment on or make changes to this bug.
Description Sven Gothel 2015-08-10 15:49:55 CEST

Comment 1 Sven Gothel 2015-08-10 16:22:12 CEST
*** Bug 637 has been marked as a duplicate of this bug. ***
Comment 2 Sven Gothel 2015-08-10 16:24:14 CEST
commit 2d837a7a7130702ad36b694875613fae77c7ef06:

    NEWT Window: Support non-resizable, minimize, maximize, alwaysOnBottom 
    and sticky/all-desktop (Part 1)
    Change also implements Bug 1186: 'NEWT Window: Use a Bitfield holding 
    all state flags and expose it accordingly',
    since it is essential for an efficient implementation.
    Part 1:
    - Bug 1186
      - Using Bitfield, holding public (Window) and private state bits/mask
    - Bug 1188
      - Window adds:
           - [is|set]AlwaysOnBottom(..),
           - [is|set]Resizable(..),
           - [is|set]Sticky(..),
           - [is|set]Maximized(..),
           - isChildWindow(),
      - Full implementation for X11
      - TODO: Implement for OSX and Windows
    - Manual tests:
      - TestGearsES2NEWT, TestGearsES2NEWTSimple and TestGearsES2NewtCanvasAWT
        utilize new NewtDemoListener, which has a key-listener to perform
        all [new] actions. See source code of NewtDemoListener.

NEWT X11 impl. also queries the Atoms only once at window creation .. 
reducing the server roundtrip.
Comment 3 Sven Gothel 2015-08-18 05:58:28 CEST
commit 4a9f65b176d618a8816eff6d24e683c56a4d8086

    Fix regression on X11 setVisible: in-visibility never reached on child windows
    It has been experienced that UnmapNotify is not sent for child windows 
    when using IconicState!
    Hence the visible:=false event never reaches the Window, causing an error.
    This patch only uses IconicState for top-level windows and if requested.

commit 9ad7f6d6ffe975dc0a10dac159b8de32773e1da1
    Fix regression on OSX setVisible: in-visibility never reached 
    on child windows / Fix [Un}Resizable style
    - Fix regression on OSX setVisible: in-visibility never reached 
      on child windows
      - Fix 'typo' while porting to bit-mask, i.e. '!=' -> '=='.
    - Fix [Un}Resizable style
      - Use NSResizableWindowMask only for !Undecorated and 
        if STATE_MASK_RESIZABLE is set.

commit 3ac9eca843d119902a65fdeee5456d204fbabfa4
    OSX: Add maximize horz/vert, implemented manually

commit bb4e7c5d3e13d91810a7530d6ffa0a909fdfc233
    NEWT OSX WindowDriver: Must wait for resize on main-thread (Related to Bug 1188)
    If not waiting for resize on main-thread,
    corruption may happen at continued rendering.
    This has been experienced w/ maximize-horizontally (Bug 1188).

commit 2c23b1cb343a008621e3fe642c5b8abacca48b1a
    Refine Maximized on X11 / Impl. Maximized and Iconify on Windows
      - remove updateMinMaxSize(..) - unused info
      - fix appendStateToString: show all maximized state changes if reconfig
      - add sizePosMaxInsetsChanged(..) and sendMouseEventRequestFocus(..)
        accumulating multiple callbacks from impl.
      - add: maximizedChanged(..) notification from native impl.
      - refine manual maximized mode
        used for OSX and Windows (single extent)
        - reconfigMaximizedManual(..)
        - resetMaximizedManual(..)
    X11 WindowDriver:
      - Update maximized at xreconfig, read from _NET_WM_STATE
      - Use less Java callbacks from JNI
    Windows WindowDriver:
      - Use native maximized, if HORZ && VERT,
        otherwise use manual maximized for single extent.
      - Invisible of top-window -> MINIMIZED/ICONIFY
        showing the app in task-bar.

commit 23d8cbd413ac6aca737d7a7d062c8bb6f5ac1ca5
    Windows: Implement unresizable using appropriate windows styles
    - to avoid resizing when toggling resizable (change of window border)
      we maintain 'RECT insets' in our WindowUserData struct
      and fix the client -> top position late 
      in NewtWindow_setVisiblePosSize(..)
      after any style change.
Comment 4 Sven Gothel 2015-08-18 06:03:27 CEST
Note: setVisible(false) will show the window in iconized mode where supported
      w/ committed changes.

TODO: Add getSupportedStatesMask(), querying supported features.

Otherwise implementation is as completed on X11, OSX and Windows
as possible. Your test results are welcome.
Comment 5 Sven Gothel 2015-08-18 11:27:02 CEST
  Add @since 2.3.2 tag
Comment 6 Sven Gothel 2015-08-30 06:48:48 CEST
commit 026ea7ed280bf4eb3a0e3c8434e5d993121f3eb4
    Bug 1188: Cleanup public/private[reconfig, non-reconfig] state bits
    - STATE_BIT_FULLSCREEN_SPAN is private and used for reconfigure,
      hence STATE_BIT_COUNT_RECONFIG is needed.
    - STATE_BIT_FULLSCREEN_SPAN is added at the end of public state bits

commit 417546510a93de533562b631caa4a75feeecd793
    Bug 1188: Refine reconfig state bits

commit 1d71a21d9d1da21c555207d30d202f724ae269f2
    Bug 1188: Introduce getSupportedStateMask() implemented via WindowDriver's getSupportedReconfigMaskImpl()
    - See getSupportedStateMask() for semantics
    - getSupportedReconfigMaskImpl() result now used for isReconfigureMaskSupported()
    - getSupportedReconfigMaskImpl() implementations:
      - Full featured: X11, Windows and OSX
      - X11: Use WindowManager Atoms for certain features (dynamic)
      - Others: Use fixed features.
    - TODO: Consider avoiding actions if not supported.

commit 725e9acfcdd0e16a3533d097692a912383bae3fc
    Bug 1188: Fix API doc of getSupportedStateMask(); Misc Changes (see below)
    - Simplify resetStateMask()
    - Windows WindowDriver: Remove STATE_MASK_STICKY from supported states
    - TestGearsNEWT: Use NEWTDemoListener

commit 522fe5ac2ef057286e4cbfa170aa4292c4ffed2d
    Bug 1188: NEWT WindowsWindow.c: Better support for 'isOnBottom' on Windows (Fullscreen on Bottom not working though)
    - Terminology
      - ALWAYSONBOTTOM -> isOnBottom
      - ALWAYSONTOP -> isOnTop
    - Better support for 'isOnBottom' on Windows
      - Refine 'SetWindowPos(..)' calls to handle isOn[Top|Bottom]
      - Refine 'ShowWindow(..)' calls to handle isOnBottom
      - Intercept WM_WINDOWPOSCHANGING to enforce isOn[Top|Bottom],
        i.e. change params (hwndInsertAfter and flags).
    - Fullscreen on Bottom not working
      - While we change all flags appropriately (NOACTIVATE, ..)
        and don't issue CDS_FULLSCREEN is on bottom,
        Windows seems to enforce the window to be on top
        if it is sized to the screen maximum.
Comment 7 Sven Gothel 2015-08-30 06:49:32 CEST
TODO: Consider avoiding actions if not supported.
Comment 8 Sven Gothel 2015-08-30 06:58:19 CEST
Bug 1208 will cont this task, 
i.e. consider avoiding operations if not supported, see getSupportedStateMask().

If severe bugs are still present - please reopen and report.
Closing for now, since implementation is feature complete
as much as possible for X11, Windows and OSX.
Comment 9 Sven Gothel 2015-08-31 08:45:20 CEST

   Bug 1188: Refine getSupportedStateMask() semantics and minimum requirements (adding STATE_MASK_FULLSCREEN)
    Refine getSupportedStateMask():
     - always for _after_ native creation, i.e. first visibility
     - adding STATE_MASK_FULLSCREEN to minimum requirements
Comment 10 Xerxes Rånby 2015-09-03 16:00:19 CEST
I have found a corner case with the new setResizable implementation that behave unexpected:


Bug 1188: Add junit test test03WindowLargerThanScreenAndNonResizeable
Test that the window do not auto-resize to fit inside the screeen
when the user requests a non-resizable window that is larger than the screen.
Comment 11 Sven Gothel 2015-09-26 03:42:31 CEST
commit fa3c55b8176b284752ed14a5a24f7fee36e588a3:

Fix setMaximized(..) isReconfigureMaskSupported(..) query
setMaximized(..) isReconfigureMaskSupported(..) was using the state bit-number
instead of the state bit-mask!