summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Endrodi <ext-adam.endrodi@nokia.com>2010-12-10 17:12:03 +0200
committerAdam Endrodi <ext-adam.endrodi@nokia.com>2010-12-14 16:24:55 +0200
commit016a622291eb22293b9a7af4c64b31ff0042222c (patch)
tree93707f2729d84d2c7966d4edccca83116005561d
parentf5c3c522eda88faf585dbc28b6407555f52d2d75 (diff)
add MWindowPropertyCache::orientationAngle()
To make it easy to query a window's orientaion. * src/mcompatoms_p.h * src/mcompositemanager.cpp: Add the _MEEGOTOUCH_ORIENTATION_ANGLE atom. * src/mwindowpropertycache.h * src/mwindowpropertycache.cpp: Query and cache it.
-rw-r--r--src/mcompatoms_p.h1
-rw-r--r--src/mcompositemanager.cpp1
-rw-r--r--src/mwindowpropertycache.cpp31
-rw-r--r--src/mwindowpropertycache.h7
4 files changed, 40 insertions, 0 deletions
diff --git a/src/mcompatoms_p.h b/src/mcompatoms_p.h
index 18dd3cc..f25d52f 100644
--- a/src/mcompatoms_p.h
+++ b/src/mcompatoms_p.h
@@ -98,6 +98,7 @@ public:
_MEEGOTOUCH_CANNOT_MINIMIZE,
_MEEGOTOUCH_MSTATUSBAR_GEOMETRY,
_MEEGOTOUCH_CUSTOM_REGION,
+ _MEEGOTOUCH_ORIENTATION_ANGLE,
#ifdef WINDOW_DEBUG
_M_WM_INFO,
diff --git a/src/mcompositemanager.cpp b/src/mcompositemanager.cpp
index 8b8ae9d..c9bd0a2 100644
--- a/src/mcompositemanager.cpp
+++ b/src/mcompositemanager.cpp
@@ -183,6 +183,7 @@ MCompAtoms::MCompAtoms()
"_MEEGOTOUCH_CANNOT_MINIMIZE",
"_MEEGOTOUCH_MSTATUSBAR_GEOMETRY",
"_MEEGOTOUCH_CUSTOM_REGION",
+ "_MEEGOTOUCH_ORIENTATION_ANGLE",
#ifdef WINDOW_DEBUG
// custom properties for CITA
diff --git a/src/mwindowpropertycache.cpp b/src/mwindowpropertycache.cpp
index 96cd59d..ce31f77 100644
--- a/src/mwindowpropertycache.cpp
+++ b/src/mwindowpropertycache.cpp
@@ -61,6 +61,7 @@ void MWindowPropertyCache::init()
dont_iconify = false;
custom_region = 0;
custom_region_request_fired = false;
+ orientation_angle = 0;
xcb_real_geom = 0;
damage_object = 0;
@@ -80,6 +81,8 @@ void MWindowPropertyCache::init_invalid()
memset(&xcb_is_decorator_cookie, 0, sizeof(xcb_is_decorator_cookie));
memset(&xcb_window_type_cookie, 0, sizeof(xcb_window_type_cookie));
memset(&xcb_decor_buttons_cookie, 0, sizeof(xcb_decor_buttons_cookie));
+ memset(&xcb_orientation_angle_cookie, 0,
+ sizeof(xcb_orientation_angle_cookie));
memset(&xcb_wm_protocols_cookie, 0, sizeof(xcb_wm_protocols_cookie));
memset(&xcb_wm_state_cookie, 0, sizeof(xcb_wm_state_cookie));
memset(&xcb_wm_hints_cookie, 0, sizeof(xcb_wm_hints_cookie));
@@ -142,6 +145,9 @@ MWindowPropertyCache::MWindowPropertyCache(Window w,
xcb_decor_buttons_cookie = xcb_get_property(xcb_conn, 0, window,
ATOM(_MEEGOTOUCH_DECORATOR_BUTTONS),
XCB_ATOM_CARDINAL, 0, 8);
+ xcb_orientation_angle_cookie = xcb_get_property(xcb_conn, 0, window,
+ ATOM(_MEEGOTOUCH_ORIENTATION_ANGLE),
+ XCB_ATOM_CARDINAL, 0, 8);
xcb_wm_protocols_cookie = xcb_get_property(xcb_conn, 0, window,
ATOM(WM_PROTOCOLS),
XCB_ATOM_ATOM, 0, 100);
@@ -260,6 +266,7 @@ MWindowPropertyCache::~MWindowPropertyCache()
r = xcb_get_property_reply(xcb_conn, xcb_custom_region_cookie, 0);
if (r) free(r);
}
+ xcb_discard_reply(xcb_conn, xcb_orientation_angle_cookie.sequence);
if (custom_region) delete custom_region;
if (wm_state_query)
windowState();
@@ -649,6 +656,11 @@ bool MWindowPropertyCache::propertyEvent(XPropertyEvent *e)
ATOM(_MEEGOTOUCH_DECORATOR_BUTTONS),
XCB_ATOM_CARDINAL, 0, 8);
emit meegoDecoratorButtonsChanged(window);
+ } else if (e->atom == ATOM(_MEEGOTOUCH_ORIENTATION_ANGLE)) {
+ xcb_discard_reply(xcb_conn, xcb_orientation_angle_cookie.sequence);
+ xcb_orientation_angle_cookie = xcb_get_property(xcb_conn, 0, window,
+ ATOM(_MEEGOTOUCH_ORIENTATION_ANGLE),
+ XCB_ATOM_CARDINAL, 0, 8);
} else if (e->atom == ATOM(WM_PROTOCOLS)) {
if (!wm_protocols_valid)
// collect the old reply
@@ -757,6 +769,25 @@ const QRect &MWindowPropertyCache::closeButtonGeometry()
return close_button_geom;
}
+unsigned MWindowPropertyCache::orientationAngle()
+{
+ xcb_get_property_reply_t *r;
+
+ if (!xcb_orientation_angle_cookie.sequence)
+ return orientation_angle;
+
+ orientation_angle = 0;
+ r = xcb_get_property_reply(xcb_conn, xcb_orientation_angle_cookie, 0);
+ if (r != NULL) {
+ if (xcb_get_property_value_length(r) == sizeof(CARD32))
+ orientation_angle = *((CARD32*)xcb_get_property_value(r));
+ free(r);
+ }
+ xcb_orientation_angle_cookie.sequence = 0;
+
+ return orientation_angle;
+}
+
const QList<Atom>& MWindowPropertyCache::supportedProtocols()
{
if (!is_valid || wm_protocols_valid)
diff --git a/src/mwindowpropertycache.h b/src/mwindowpropertycache.h
index 1b1d0bb..911dd32 100644
--- a/src/mwindowpropertycache.h
+++ b/src/mwindowpropertycache.h
@@ -232,6 +232,11 @@ public:
const QRegion &customRegion(bool request_only = false);
/*!
+ * Returns the value of _MEEGOTOUCH_ORIENTATION_ANGLE.
+ */
+ unsigned orientationAngle();
+
+ /*!
* Called on PropertyNotify for this window.
* Returns true if we should re-check stacking order.
*/
@@ -303,6 +308,7 @@ private:
bool being_mapped, dont_iconify;
QRegion *custom_region;
bool custom_region_request_fired;
+ unsigned orientation_angle;
// geometry is requested only once in the beginning, after that, we
// use ConfigureNotifys to update the size through setRealGeometry()
xcb_get_geometry_reply_t *xcb_real_geom;
@@ -322,6 +328,7 @@ private:
xcb_get_property_cookie_t xcb_always_mapped_cookie;
xcb_get_property_cookie_t xcb_cannot_minimize_cookie;
xcb_get_property_cookie_t xcb_custom_region_cookie;
+ xcb_get_property_cookie_t xcb_orientation_angle_cookie;
xcb_render_query_pict_formats_cookie_t xcb_pict_formats_cookie;
xcb_shape_get_rectangles_cookie_t xcb_shape_rects_cookie;
QRegion shape_region;