Commit Graph

6 Commits (bc236f3a4d6615288888689f9d73e083fab3b0de)

Author SHA1 Message Date
Marco Martin 490e733590 Distinguish empty and non existent properties
This restores the behavior on KWin4: if I set an X property that doesn't have any data on a window, it's still information, so this makes the Xcb wrapper return an empty QByteArray that is not null.
EffectWindow::readProperty() now returns an empty QByteArray constructed the same way as it was in KWin4.

REVIEW:118645
BUG:335446
2014-06-11 11:08:02 +02:00
Martin Gräßlin b45eeae352 [Xcb::Wrapper] Introduce a Property and StringProperty Wrapper subclass
The Xcb::Property can wrap the xcb_get_property call and provides
convenient access methods to read the value of the reply with checks
applied. For this it provides a templated ::value method for reading a
single value or reading an array. There's also a ::toBool and
::toByteArray which performs the conversion directly with default values
for the type and format checks.

Xcb::TransientFor is changed to be derived from Property instead of
Wrapper directly, so that the reading of the property value can be
shared.

Xcb::StringProperty is a convenient wrapper derived from Property to
handle the reading of a string property providing a cast to QByteArray
operator. This replaces the ::getStringProperty from utils. Though the
separator functionality from ::getStringProperty is not provided as that
is only used in one function and handled there.

All the custom usages of xcb_get_property or getStringProperty are
replaced to use this new wrapper. That simplifies the code and ensures
that all properties are read in the same way.

REVIEW: 117574
2014-04-17 07:41:33 +02:00
Martin Gräßlin 98f259d63e [Xcb::Wrapper] Add unit test for TransientFor 2014-04-17 07:41:11 +02:00
Martin Gräßlin e25abdf3bb [Xcb::Wrapper] Add unit test for CurrentInput 2014-04-17 07:41:11 +02:00
Martin Gräßlin 9db9f172bc [Xcb::Wrapper] Add a unit test for Xcb::Tree
Based on the test Tree::children() is extended for a test case on no
children which used to return a garbage pointer.
2014-04-17 07:41:11 +02:00
Martin Gräßlin 04716ae5e3 [kwin] Rename tests subdirectories to autotests
Follows the naming schemes in frameworks and opens up the possibility
to include test applications for KWin in the tests subdirectory.
2014-01-30 11:01:59 +01:00