Menu

#23 Joxy-themed windows do not get a radial background anymore in the window decoration

future
open
nobody
None
minor
laf
2014-05-04
2014-05-04
Willem3141
No

See this bug report. The settings in the Oxygen window decoration have changed. This results in the strange situation that while Joxy draws a nice radial background to perfectly match the Oxygen window decoration, Oxygen doesn't draw this window decoration anymore because it thinks that Java applications are not able to draw the radial background or something... See the screenshot attached.

From here it seems that we should set some X Atom to let Oxygen know that it should draw a radial background...

1 Attachments

Discussion

  • Willem3141

    Willem3141 - 2014-05-04
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,3 +1,3 @@
    -See [this](https://bugs.kde.org/show_bug.cgi?id=330035) bug report. The settings in the Oxygen window decoration have changed. This results in the strange situation that while Joxy draws a nice radial background to perfectly match the Oxygen window decoration, Oxygen doesn't draw this window decoration anymore... See the screenshot attached.
    +See [this](https://bugs.kde.org/show_bug.cgi?id=330035) bug report. The settings in the Oxygen window decoration have changed. This results in the strange situation that while Joxy draws a nice radial background to perfectly match the Oxygen window decoration, Oxygen doesn't draw this window decoration anymore because it thinks that Java applications are not able to draw the radial background or something... See the screenshot attached.
    
     From [here](http://web.archiveorange.com/archive/v/bZBuSSCpNpho3d30Vtlr) it seems that we should set some X Atom to let Oxygen know that it should draw a radial background...
    
     
  • Willem3141

    Willem3141 - 2014-05-04

    Setting this X Atom works indeed: Oxygen nicely draws its radial background again. Now the next question is how we are going to call this for every JFrame that is styled by Joxy.

    For reference, this is the code to do this:

        /**
         * Test to integrate with the Oxygen window decoration...
         */
        @SuppressWarnings("restriction")
        protected static void setOxygenGradientHint(Frame frame) {
            try {
                // long windowId = peer.getWindow();
                Field peerField = Component.class.getDeclaredField("peer");
                peerField.setAccessible(true);
                Class<?> xWindowPeerClass = Class.forName("sun.awt.X11.XWindowPeer");
                Method getWindowMethod = xWindowPeerClass.getMethod("getWindow", new Class[0]);
                long windowId = ((Long) getWindowMethod.invoke(peerField.get(frame), new Object[0])).longValue();
    
                sun.awt.X11.XAtom.get("_KDE_OXYGEN_BACKGROUND_GRADIENT").setCard32Property(windowId, 1);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    
     
  • Willem3141

    Willem3141 - 2014-05-04

    I have put this code in the paint method of JRootPane. See commit [c2a7b8].

    That seems to work, however, one needs to resize the JFrame before X11 / Oxygen seems to "pick up" this change. Since my knowledge of the X11 protocol is quite non-existing, I think we should ask this to the Oxygen developers...

     

    Related

    Commit: [c2a7b8]

  • Willem3141

    Willem3141 - 2014-05-04

    Hmm, this doesn't work for Dialogs since they are not Frames. Let's see how to fix that...

     
  • Willem3141

    Willem3141 - 2014-05-04

    Okay, that is fixed in [8b3195].

     

    Related

    Commit: [8b3195]


Log in to post a comment.