From 0bbd42fc906c4ce887a90ebb2ffb950efe93f703 Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Fri, 31 Aug 2012 16:55:43 -0300 Subject: Moved function "GetWindowName" from UnityWindow to WindowManager. (bzr r2650.1.1) --- plugins/unityshell/src/unityshell.cpp | 81 +---------------------------------- plugins/unityshell/src/unityshell.h | 5 --- 2 files changed, 1 insertion(+), 85 deletions(-) (limited to 'plugins/unityshell/src') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 640fd3654..a22da6e54 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -3611,7 +3611,7 @@ void UnityWindow::RenderText (WindowCairoContext *context, pango_layout_set_auto_dir (layout, false); pango_layout_set_text (layout, - GetWindowName (window->id ()).c_str (), + WindowManager::Default()->GetWindowName(window->id()).c_str(), -1); /* update the size of the pango layout */ @@ -3863,85 +3863,6 @@ bool UnityPluginVTable::init() return true; } -CompString UnityWindow::GetUtf8Property (Window id, - Atom atom) -{ - Atom type; - int result, format; - unsigned long nItems, bytesAfter; - char *val; - CompString retval; - Atom utf8StringAtom; - - utf8StringAtom = XInternAtom (screen->dpy (), "UTF8_STRING", 0); - result = XGetWindowProperty (screen->dpy (), id, atom, 0L, 65536, False, - utf8StringAtom, &type, &format, &nItems, - &bytesAfter, (unsigned char **) &val); - - if (result != Success) - return retval; - - if (type == utf8StringAtom && format == 8 && val && nItems > 0) - { - char valueString[nItems + 1]; - strncpy (valueString, val, nItems); - valueString[nItems] = 0; - retval = valueString; - } - if (val) - XFree (val); - - return retval; -} - -CompString UnityWindow::GetTextProperty (Window id, - Atom atom) -{ - XTextProperty text; - CompString retval; - - text.nitems = 0; - if (XGetTextProperty (screen->dpy (), id, &text, atom)) - { - if (text.value) - { - char valueString[text.nitems + 1]; - - strncpy (valueString, (char *) text.value, text.nitems); - valueString[text.nitems] = 0; - - retval = valueString; - - XFree (text.value); - } - } - - return retval; -} - - -CompString UnityWindow::GetWindowName (Window id) -{ - CompString name; - Atom visibleNameAtom; - - visibleNameAtom = XInternAtom (screen->dpy (), "_NET_WM_VISIBLE_NAME", 0); - name = GetUtf8Property (id, visibleNameAtom); - if (name.empty ()) - { - Atom wmNameAtom = XInternAtom (screen->dpy (), "_NET_WM_NAME", 0); - name = GetUtf8Property (id, wmNameAtom); - } - - - if (name.empty ()) - name = GetTextProperty (id, XA_WM_NAME); - - return name; -} - - - namespace { diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h index b9bea314a..b9afe93d2 100644 --- a/plugins/unityshell/src/unityshell.h +++ b/plugins/unityshell/src/unityshell.h @@ -482,11 +482,6 @@ private: float maxWidth, float maxHeight); WindowCairoContext* CreateCairoContext (float width, float height); - // based on compiz text plugin - CompString GetWindowName (Window id); - CompString GetUtf8Property (Window id, Atom atom); - CompString GetTextProperty (Window id, Atom atom); - compiz::WindowInputRemoverLock::Weak input_remover_; glib::Source::UniquePtr focus_desktop_timeout_; -- cgit v1.2.3