SSブログ

【Ubuntu 11.10】Unity 4.14.2になってDashメニューを開くと、ボタン(閉じる/最小化/最大化)にテーマが適応されなくなった。(仮対処) [ubuntu]

2011/9/10にアップデートしたらUnityが4.14.2になりました。

そしたら、Dashメニューを開くと右上のボタン(閉じる/最小化/最大化)ボタンにテーマが適応されなくなりました。

SS-Dash-button-002.jpeg

それで、調べてみたところ、Dashメニューのパネル上のボタンはWindowsButton.cppのファイルでGetDashWindowButtonとGetDashMaximizeWindowButtonという関数を呼んでイメージを独自に取得していました。

取得する先のイメージファイルは、/usr/share/unity/4 内にある、ファイル名にdashという文字が入っているファイルです。

せっかくテーマがあるのに使えないのは、もったいなので適当に直してしまいました。

Dashメニューを開いたスクリーンショット。

SS-Dash-button-003.jpeg

Dashメニューを最大化したスクリーンショット。

SS-Dash-button-004.jpeg

上図の2つのスクリーンショットをよく比べてみると、左上の3つ並んでいるうちの一番右の「最大化ボタン」がちょっと違います。

これ、まだバグがあってログインして最初にDashメニューを開いた時には、最大化ボタンの初期イメージが間違ってます。一度、最大化を行うと正常に戻るのですが・・・

 

<< 直し方 >>

まってれば直ると思うので簡単に。。。

それに下記の方法は私独自の方法なので、非推奨です。

1) Unityのビルド環境を整える。

2) 下記のパッチを当てる。(または、下記を見て編集する)

diff -urN unity-4.14.2.org/plugins/unityshell/src/PanelStyle.cpp unity-4.14.2/plugins/unityshell/src/PanelStyle.cpp
--- unity-4.14.2.org/plugins/unityshell/src/PanelStyle.cpp    2011-09-09 00:14:39.000000000 +0900
+++ unity-4.14.2/plugins/unityshell/src/PanelStyle.cpp    2011-09-10 08:56:34.109067608 +0900
@@ -154,7 +154,7 @@
 PanelStyle::GetWindowButton(WindowButtonType type, WindowState state)
 {
   nux::BaseTexture* texture = NULL;
-  const char* names[] = { "close", "minimize", "unmaximize" };
+  const char* names[] = { "close", "minimize", "unmaximize","maximize" };
   const char* states[] = { "", "_focused_prelight", "_focused_pressed" };
 
   std::ostringstream subpath;
diff -urN unity-4.14.2.org/plugins/unityshell/src/PanelStyle.h unity-4.14.2/plugins/unityshell/src/PanelStyle.h
--- unity-4.14.2.org/plugins/unityshell/src/PanelStyle.h    2011-09-09 00:14:39.000000000 +0900
+++ unity-4.14.2/plugins/unityshell/src/PanelStyle.h    2011-09-10 08:57:07.453066852 +0900
@@ -31,7 +31,8 @@
   {
     WINDOW_BUTTON_CLOSE = 0,
     WINDOW_BUTTON_MINIMIZE,
-    WINDOW_BUTTON_UNMAXIMIZE
+    WINDOW_BUTTON_UNMAXIMIZE,
+    WINDOW_BUTTON_MAXIMIZE
 
   } WindowButtonType;
 
diff -urN unity-4.14.2.org/plugins/unityshell/src/WindowButtons.cpp unity-4.14.2/plugins/unityshell/src/WindowButtons.cpp
--- unity-4.14.2.org/plugins/unityshell/src/WindowButtons.cpp    2011-09-09 00:14:39.000000000 +0900
+++ unity-4.14.2/plugins/unityshell/src/WindowButtons.cpp    2011-09-10 09:35:23.377014982 +0900
@@ -244,7 +244,7 @@
 
   nux::BaseTexture* GetDashWindowButton(PanelStyle::WindowButtonType type, PanelStyle::WindowState state)
   {
-    const char* names[] = { "close_dash", "minimize_dash", "unmaximize_dash" };
+/*    const char* names[] = { "close_dash", "minimize_dash", "unmaximize_dash" };
     const char* states[] = { "", "_prelight", "_pressed" };
 
     std::ostringstream subpath;
@@ -256,12 +256,16 @@
     glib::Object<GdkPixbuf> pixbuf(gdk_pixbuf_new_from_file(filename.Value(), &error));
 
     // not handling broken texture or missing files
-    return nux::CreateTexture2DFromPixbuf(pixbuf, true);
+    return nux::CreateTexture2DFromPixbuf(pixbuf, true); */
+
+    PanelStyle* style = PanelStyle::GetDefault();
+
+    return style->GetWindowButton(type, state);
   }
 
   nux::BaseTexture* GetDashMaximizeWindowButton(PanelStyle::WindowState state)
   {
-    const char* states[] = { "", "_prelight", "_pressed" };
+/*    const char* states[] = { "", "_prelight", "_pressed" };
 
     std::ostringstream subpath;
     subpath << "maximize_dash" << states[state] << ".png";
@@ -271,8 +275,13 @@
     glib::Error error;
     glib::Object<GdkPixbuf> pixbuf(gdk_pixbuf_new_from_file(filename.Value(), &error));
 
-    // not handling broken texture or missing files
-    return nux::CreateTexture2DFromPixbuf(pixbuf, true);
+    // not handling broken texture or missing files
+    return nux::CreateTexture2DFromPixbuf(pixbuf, true); */
+
+    PanelStyle* style = PanelStyle::GetDefault();
+
+    return style->GetWindowButton(PanelStyle::WINDOW_BUTTON_MAXIMIZE, state);
+
   }
 };
 
3) ビルドして、 作成したunity_4.14.2-0ubuntu1_i386.debから/usr/lib/compiz/libunityshell.so をインストールされているものと置き換える。

4) /usr/share/themes/<テーマ名>/unityもしくは~/.themes/<テーマ名>/unityの中にmaximize.png, maximize_focused_prelight.png, maximize_focused_pressed.pngを作成する。(Ambianceのテーマは作成しなくても、既にあります。)

5) Unityをリスタートする(ログアウト&ログインでもOK)

これで一応直ります。(他に影響があるかは調べてません。)

Dashメニューのボタンくらいは直してから公開して欲しかった・・・

 

 ← USB ライト

    USBに差して使うライト
    手元の細かい所を見るのにいいかも・・
    でも、私の場合は汚れも沢山見える可能性が・・・


nice!(0)  コメント(0) 
共通テーマ:パソコン・インターネット

nice! 0

コメント 0

コメントを書く

お名前:
URL:
コメント:
画像認証:
下の画像に表示されている文字を入力してください。

Facebook コメント

この広告は前回の更新から一定期間経過したブログに表示されています。更新すると自動で解除されます。