Issue 112102 - OOo quits with X error when using non-"Oxygen" theme in KDE 4.4
Summary: OOo quits with X error when using non-"Oxygen" theme in KDE 4.4
Status: CLOSED FIXED
Alias: None
Product: gsl
Classification: Code
Component: code (show other issues)
Version: DEV300m76
Hardware: PC (x86_64) Linux, all
: P3 Trivial (vote)
Target Milestone: OOo 3.3
Assignee: philipp.lohmann
QA Contact: issues@gsl
URL: http://bugs.debian.org/cgi-bin/bugrep...
Keywords: regression
Depends on:
Blocks:
 
Reported: 2010-06-04 01:43 UTC by cknadle
Modified: 2010-07-19 15:20 UTC (History)
7 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
Proposed change. (1.68 KB, patch)
2010-06-14 16:14 UTC, pmladek
no flags Details | Diff
screenshot with PM_LayoutLeftMargin (3.98 KB, image/png)
2010-06-15 10:56 UTC, philipp.lohmann
no flags Details
screenshot with PM_DefaultFrameWidth+1 (5.46 KB, image/png)
2010-06-15 10:57 UTC, philipp.lohmann
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description cknadle 2010-06-04 01:43:21 UTC
This bug was found using the openoffice.org packages in Debian Sid, bug number
584322 -- see URL field for reference.

There have been some recent changes to OO v3.2.0 which appears to cause Writer
to quit on startup with an error when using the "Plastique" theme in KDE 4.4,
regardless if a file is specified or not:

-------------------------------------------------
cknadle@Trelane:~$ export SAL_SYNCHRONIZE=1
cknadle@Trelane:~$ oowriter
cknadle@Trelane:~$ X-Error: BadMatch (invalid parameter attributes)
        Major opcode: 59 (X_SetClipRectangles)
        Resource ID:  0x4e00169
        Serial No:    8154 (8154)
-------------------------------------------------

The previous version of openoffice.org (3.2.0-9+b1) in Debian Sid does not show
this error.  The error also does not show when using the Oxygen theme in KDE4.

The work-around from OO bug #109176 of 'export OOO_FORCE_DESKTOP=none' execution
before starting Writer also works here.

   http://www.openoffice.org/issues/show_bug.cgi?id=109176


We believe we have debugged this down to changes within the openoffice.org-kde
Debian package between versions 3.2.0-9+b1 and 3.2.0-10, and between those two
packages only two files have changed:

     /usr/lib/openoffice/basis3.2/program/fps_kde4.uno.so
     /usr/lib/openoffice/basis3.2/program/libvclplug_kde4lx.so

I'll see if I can get a diff for those files from the source packages.

   -- Chris

Chris Knadle
Chris.Knadle@coredump.us
Comment 1 rene 2010-06-04 07:44:51 UTC
The important difference between -9 and -10 here is the fix for issue 107945.

So it's actually a KDE VCLplug problem. Reassigning to gsl.
Comment 2 rene 2010-06-04 07:45:12 UTC
.
Comment 3 rene 2010-06-04 10:57:45 UTC
> 
Comment 4 rene 2010-06-04 11:50:01 UTC
submitter says:

"Additionally, I also /don't/ see this bug on i386 -- I tested on another box    
and OO Writer 3.2.0-10 seems to work fine with the Plastique theme there."
Comment 5 cknadle 2010-06-04 18:31:31 UTC
Please note, I misreported part of the problem; this is not an issue that is
part of stable OpenOffice 3.2.0, but rather and issue in OpenOffice 3.3, as it
was a fix within v3.3 that was backported to v3.2.0 that seems to cause this issue.
Comment 6 hdu@apache.org 2010-06-09 14:15:36 UTC
The problem happens for all other kde44-widget styles (CDE, CleanLooks, MSW95Look, Motif, Plastique) 
but not for Oxygen.
Comment 7 pmladek 2010-06-14 16:14:07 UTC
As Rene already mentioned, it is related to the fix for the issue #107945 and
the code:

--- cut ---
        int size = kapp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin);
        pTempClipRegion = XCreateRegion();
        XRectangle xRect = { widgetRect.left(), widgetRect.top(),
widgetRect.width(), widgetRect.height() };
        XUnionRectWithRegion( &xRect, pTempClipRegion, pTempClipRegion );
        XLIB_Region pSubtract = XCreateRegion();
        xRect.x += size;
        xRect.y += size;
        xRect.width -= 2* size;
        xRect.height -= 2*size;
        XUnionRectWithRegion( &xRect, pSubtract, pSubtract );
        XSubtractRegion( pTempClipRegion, pSubtract, pTempClipRegion );
        XDestroyRegion( pSubtract );
--- cut ---

QStyle::PM_LayoutLeftMargin is 9 in Plastic, so the xRect.height overflow for
too small widgets and X-server is not happy with it.

pTempClipRegion defined are area above the frame border. PM_LayoutLeftMargin
does not work well. I suggest to use PM_DefaultFrameWidth instead.

Also, I suggest to add check for the overflow.

I'll attach a patch that solved the problem here.
Comment 8 pmladek 2010-06-14 16:14:57 UTC
Created attachment 69993 [details]
Proposed change.
Comment 9 philipp.lohmann 2010-06-14 16:50:48 UTC
Thanks for the patch ! And just when my own install set is almost ready after
all :-)

will commit to CWS ooo30gsl01 (slated for 3.3)
Comment 10 philipp.lohmann 2010-06-15 09:02:44 UTC
Sorry, but this gives us back a paint error with frames (if I remember this is
the reason why originally QStyle::PM_LayoutLeftMargin came into play). In the
oxygen theme look e.g at a new writer document; you see that the native border
around the document is not actually drawn and you get a paint error.

Now we have QStyle::PM_DefaultFrameWidth for the frame width which came in with
issue 111464 and I get this paint error - which seems to have escaped my notice
when I committed to CWS vcl111, sorry.

The patch actually preventing the invalid region is correct, but I think in case
the rectangle gets degenerate, we could skip the whole
XCreateRegion/XSubtractRegion code.

@kendy: any input on the PM_DefaultFrameWidth thing ?
@pmladek: ok with skipping the region subtracting in case the rectangle has
height or width 0 ?
Comment 11 pmladek 2010-06-15 10:47:09 UTC
If we use QStyle::PM_LayoutLeftMargin, we will not see the status bar in most
KDE4 themes. It is too wide and it replaces the useful content there.

Hmm, I see the border in the new Writer window with the Oxygen theme with my diff.

I think that the important difference is the "+1" in
int nFrameWidth = kapp->style()->pixelMetric(QStyle::PM_DefaultFrameWidth) + 1;

I do not like magic constants. A better solution might be to get the real border
width via QFrame:frameWidth(), see
http://doc.qt.nokia.com/4.6/qframe.html#frameWidth-prop. Though, I am not
mistaken, we do not have the real QT widget available in the method.

The "QStyle::PM_DefaultFrameWidth) + 1" looks like a good compromise. It works
well in many themes. In each case, I think that the content is more important
than the border ;-)
Comment 12 philipp.lohmann 2010-06-15 10:56:53 UTC
Created attachment 70009 [details]
screenshot with PM_LayoutLeftMargin
Comment 13 philipp.lohmann 2010-06-15 10:57:49 UTC
Created attachment 70010 [details]
screenshot with PM_DefaultFrameWidth+1
Comment 14 philipp.lohmann 2010-06-15 11:02:02 UTC
Attached two screen shots that illustrate the results on OpenSuSE 11.2 with the
oxygen theme. The frame in the PM_DefaultFrameWidth+1 is a paint error.

Now in status bar there is no frame anymore since issue 108321 got integrated in
3.3, so that problem vanishes.
Comment 15 pmladek 2010-06-15 11:09:53 UTC
pmladek->pl: Sigh, I have missed this. I do not see the messy white border here,
so it is less visible.

Do you have any idea about a better solution?
Comment 16 pmladek 2010-06-15 11:12:06 UTC
Ah, I have missed the note about the issue #108321. If the status bar border was
removed, QStyle::PM_LayoutLeftMargin might be fine after all.
Comment 17 philipp.lohmann 2010-06-15 11:15:57 UTC
If I paint the status bar items bordered again, DefaultFrameWidth+1 does not
work right either, the frames are clipped. I think the frame is actually larger
that 2 pixel in that Oxygen theme.
Comment 18 philipp.lohmann 2010-06-15 11:23:21 UTC
Actually I hoped kendy has insight. I tend to go with reverting to
PM_LayoutLeftMargin, but that would undo kendy's change of issue 111464. Which I
assume he made with good reason.
Comment 19 kendy 2010-06-15 13:40:15 UTC
pl: So, I believe QStyle::PM_Layout(Left|Right|Top|Bottom)Margin values are
completely wrong in the context of getNativeControlRegion(), they define the
spacing in layout, ie. _between_ the widgets, not inside them.

To me it seems that the correct way would be to use QStyleFrameOption for frames
(and similarly for edit boxes), and get the information from there (ie. even my
QStyle::PM_DefaultFrameWidth is not 100% perfect).
Comment 20 philipp.lohmann 2010-06-15 14:39:43 UTC
That seems sensible. Indeed creating a QFrame and asking it for frameWidth()
seems to do the trick (the value is 3 then and the paint seems ok). So I'll
change getNativeControlRegion and drawNativeControl to use that - I assume I can
cache the value.
Comment 21 philipp.lohmann 2010-06-15 14:50:40 UTC
done so in CWS ooo30gsl01

changeset at http://hg.services.openoffice.org/cws/ooo30gsl01/rev/ad9152ac9a1c
Comment 22 kendy 2010-06-15 15:24:09 UTC
pl: Thank you a lot!  Not sure how the KDE4 plugin behaves when the theme
changes; KDE3 vclplug have been ignoring the event IIRC.
Comment 23 philipp.lohmann 2010-06-15 15:35:02 UTC
Currently the KDE4 plugin also does not react on theme changes.
Comment 24 philipp.lohmann 2010-06-16 17:46:27 UTC
can anybody please verify this issue ? If an install set is needed, I can
provide a Linux X64 one.
Comment 25 pmladek 2010-06-17 10:40:49 UTC
I will verify it later today or tomorrow. I'll do it with my build.
Comment 26 philipp.lohmann 2010-06-18 15:09:09 UTC
verified in CWS ooo30gsl01
Comment 27 pmladek 2010-06-18 18:28:22 UTC
pmladek->pl: I am sorry that it took me so long. I could confirm that the
changes are fine in CWS ooo30gsl01.

Just a nitpicking. You added "#include <stdio.h>" in
http://hg.services.openoffice.org/cws/ooo30gsl01/rev/ad9152ac9a1c. I think that
it was only for debugging and you did not really wanted to commit it.
Comment 28 philipp.lohmann 2010-06-21 09:57:46 UTC
@pmladek: thanks for verifying. I would have waited but my QA-Rep wanted to get
this CWS in before branch off. I removed the include, which is as you pointed
out a debug remnant. Thanks for finding that.
Comment 29 philipp.lohmann 2010-07-19 15:20:11 UTC
integrated in OOO330m1

closing