Pivot
  1. Pivot
  2. PIVOT-781

Unable to get an initially maximized HostFrame in DesktopApplicationContext due to bug in Java 6 under ubuntu/linux

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0.3
    • Component/s: wtk
    • Labels:
      None
    • Environment:
      Ubuntu 11.04 (2.6.38-10-generic), java-6-sun-1.6.0.26

      Description

      When using --maximized=true when starting a desktop application with DesktopApplicationContext.main(class, args) under the environment described. It works under Windows 7.

      Chris Bartlet found out that there is a Java bug for this issue (setExtendedState in DesktopApplicationContext) and suggested a workaround (calling it twice, once before and once after if not already in that state) before Java 7 is established. It seems it will not be fixed for Java 6 by sun (oracle).

      Mail conversation excerpt included below:

      ---8<--------8<-----------8<--------------8<----------8<------------8<------------8<-----------8<-----------
      Java bug 6365898 - fixed in Java 7
      http://download.java.net/jdk7/changes/jdk7-b14.html

      This looks like it should be the right URL, but it is not bringing anything up
      http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6365898

      Google has it cached though
      http://www.google.com/search?q=site%3Abugs.sun.com+6365898

      If the workaround is as simple as it seems to be, then I think it
      would be worth including along with a reference to the bug and a TODO
      to remove it once Java 7 is more established, or if Pivot later
      requires Java 7.
      ---8<--------8<-----------8<--------------8<----------8<------------8<------------8<-----------8<-----------

      1. pivot_781.bxml.launch
        1.0 kB
        Sandro Martini
      2. pivot_781.bxml - full screen.launch
        1.0 kB
        Sandro Martini
      3. pivot_781.bxml - maximized.launch
        1.0 kB
        Sandro Martini
      4. pivot_781.bxml - normal.launch
        1.0 kB
        Sandro Martini

        Activity

        Show
        Chris Bartlett added a comment - Full thread from the Pivot User list http://apache-pivot-users.399431.n3.nabble.com/Trying-to-maximize-the-HostFrame-tp3213280p3213280.html
        Hide
        Sandro Martini added a comment - - edited

        We have to verify if the workaround suggested by Chris could be enough for now, and apply in 2.0.x .
        Later (for example in the 2.1, when I hope the bug will be fixed in Java) maybe remove the workaround.

        Show
        Sandro Martini added a comment - - edited We have to verify if the workaround suggested by Chris could be enough for now, and apply in 2.0.x . Later (for example in the 2.1, when I hope the bug will be fixed in Java) maybe remove the workaround.
        Hide
        Sandro Martini added a comment -

        This requires more tests, so move to 2.0.2

        Show
        Sandro Martini added a comment - This requires more tests, so move to 2.0.2
        Hide
        Sandro Martini added a comment -

        Hi all, and sorry for the delay on this ... I can work on the fix, but it's not so simple for me to test the right behaviour under Linux, so someone could do some test if I put here a patch (before committing something maybe wrong) ?

        In the meantime, today I hope to commit a test bxml file: pivot_781.bxml under tests.
        And if possible, commit here even a .launch eclise file, to simplify test execution.

        Show
        Sandro Martini added a comment - Hi all, and sorry for the delay on this ... I can work on the fix, but it's not so simple for me to test the right behaviour under Linux, so someone could do some test if I put here a patch (before committing something maybe wrong) ? In the meantime, today I hope to commit a test bxml file: pivot_781.bxml under tests. And if possible, commit here even a .launch eclise file, to simplify test execution.
        Hide
        Sandro Martini added a comment -

        Just committed the test case.

        Show
        Sandro Martini added a comment - Just committed the test case.
        Hide
        Sandro Martini added a comment -

        Eclipse launch files to simplify test execution with all different command-line parameters.

        Show
        Sandro Martini added a comment - Eclipse launch files to simplify test execution with all different command-line parameters.
        Hide
        Sandro Martini added a comment -

        Work note:
        try the fix at the end of main(), in DesktopApplicationContext, verify if in the queueCallback or not ...

        Mark the fix with soimething like this:
        // TODO This is a workaround for Java bug #6365898 on Linux (fixed only in Java 7),
        // revisit / remove later when we'll require Java 7

        After, test the right behaviour at least in Linux and Windows, and ensure to flickering or other artifact is made.
        Finally, test even when there is a SplashScreen.

        Show
        Sandro Martini added a comment - Work note: try the fix at the end of main(), in DesktopApplicationContext, verify if in the queueCallback or not ... Mark the fix with soimething like this: // TODO This is a workaround for Java bug #6365898 on Linux (fixed only in Java 7), // revisit / remove later when we'll require Java 7 After, test the right behaviour at least in Linux and Windows, and ensure to flickering or other artifact is made. Finally, test even when there is a SplashScreen.
        Hide
        Sandro Martini added a comment - - edited

        Note that in my Linux VM (ubuntu-10.04.x, with latest JDK 6 from Oracle), I had already set (ok, it was wrong in the test bxml to exit calling System.exit ... now is fixed) under Java user preferences ($USER_HOME/.java/.userPrefs/org/apache/pivot/ ) a maximized = true flag, so even when not specifying --maximized=true in command line arguments to my test case I had some wrong behaviour (in the main() inside DesktopApplicationContext, Java preferences are loaded before command line flags).
        So before proceeding with this fix I had to delete that folder, with:
        rm -r .java/.userPrefs/org/apache/pivot/
        anyway could be useful to someone, just to remember this trick.

        Note that on the save maximized flag at exit there could be something other to fix, I have to look better ...
        Ok, there is nothing to fix on this, all is good, but the trick is this:
        after the first time an application is executed maximized, when exiting this status is saved (if still maximized), but at a next execution, even if the maximized flag is NOT passed, it is loaded from Java preferences, so it will be maximized again ... the workaround here is to remove its maximized status (for example with double clicking the title bar) and exit so the new status will be saved (and loaded next times), unless someone explicitly set the maximized flag.

        Show
        Sandro Martini added a comment - - edited Note that in my Linux VM (ubuntu-10.04.x, with latest JDK 6 from Oracle), I had already set (ok, it was wrong in the test bxml to exit calling System.exit ... now is fixed) under Java user preferences ($USER_HOME/.java/.userPrefs/org/apache/pivot/ ) a maximized = true flag, so even when not specifying --maximized=true in command line arguments to my test case I had some wrong behaviour (in the main() inside DesktopApplicationContext, Java preferences are loaded before command line flags). So before proceeding with this fix I had to delete that folder, with: rm -r .java/.userPrefs/org/apache/pivot/ anyway could be useful to someone, just to remember this trick. Note that on the save maximized flag at exit there could be something other to fix, I have to look better ... Ok, there is nothing to fix on this, all is good, but the trick is this: after the first time an application is executed maximized, when exiting this status is saved (if still maximized), but at a next execution, even if the maximized flag is NOT passed, it is loaded from Java preferences, so it will be maximized again ... the workaround here is to remove its maximized status (for example with double clicking the title bar) and exit so the new status will be saved (and loaded next times), unless someone explicitly set the maximized flag.
        Hide
        Sandro Martini added a comment -

        Resolved both in 2.0.x and trunk.

        Be free to reopen in case of problems.

        Show
        Sandro Martini added a comment - Resolved both in 2.0.x and trunk. Be free to reopen in case of problems.

          People

          • Assignee:
            Sandro Martini
            Reporter:
            Tomas Stenlund
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development