Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc

Issue 317273003: Make a docked panel visible on all desktops on KDE (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/base/x/x11_util.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h" 5 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h"
6 6
7 #include <X11/extensions/shape.h> 7 #include <X11/extensions/shape.h>
8 #include <X11/extensions/XInput2.h> 8 #include <X11/extensions/XInput2.h>
9 #include <X11/Xatom.h> 9 #include <X11/Xatom.h>
10 #include <X11/Xregion.h> 10 #include <X11/Xregion.h>
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 DEFINE_WINDOW_PROPERTY_KEY( 66 DEFINE_WINDOW_PROPERTY_KEY(
67 DesktopWindowTreeHostX11*, kHostForRootWindow, NULL); 67 DesktopWindowTreeHostX11*, kHostForRootWindow, NULL);
68 68
69 namespace { 69 namespace {
70 70
71 // Constants that are part of EWMH. 71 // Constants that are part of EWMH.
72 const int k_NET_WM_STATE_ADD = 1; 72 const int k_NET_WM_STATE_ADD = 1;
73 const int k_NET_WM_STATE_REMOVE = 0; 73 const int k_NET_WM_STATE_REMOVE = 0;
74 74
75 // Special value of the _NET_WM_DESKTOP property which indicates that the window
76 // should appear on all desktops.
77 const int kAllDesktops = 0xFFFFFFFF;
78
75 const char* kAtomsToCache[] = { 79 const char* kAtomsToCache[] = {
76 "UTF8_STRING", 80 "UTF8_STRING",
77 "WM_DELETE_WINDOW", 81 "WM_DELETE_WINDOW",
78 "WM_PROTOCOLS", 82 "WM_PROTOCOLS",
79 "_NET_FRAME_EXTENTS", 83 "_NET_FRAME_EXTENTS",
80 "_NET_WM_CM_S0", 84 "_NET_WM_CM_S0",
85 "_NET_WM_DESKTOP",
81 "_NET_WM_ICON", 86 "_NET_WM_ICON",
82 "_NET_WM_NAME", 87 "_NET_WM_NAME",
83 "_NET_WM_PID", 88 "_NET_WM_PID",
84 "_NET_WM_PING", 89 "_NET_WM_PING",
85 "_NET_WM_STATE", 90 "_NET_WM_STATE",
86 "_NET_WM_STATE_ABOVE", 91 "_NET_WM_STATE_ABOVE",
87 "_NET_WM_STATE_FULLSCREEN", 92 "_NET_WM_STATE_FULLSCREEN",
88 "_NET_WM_STATE_HIDDEN", 93 "_NET_WM_STATE_HIDDEN",
89 "_NET_WM_STATE_MAXIMIZED_HORZ", 94 "_NET_WM_STATE_MAXIMIZED_HORZ",
90 "_NET_WM_STATE_MAXIMIZED_VERT", 95 "_NET_WM_STATE_MAXIMIZED_VERT",
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 } 557 }
553 558
554 bool DesktopWindowTreeHostX11::IsAlwaysOnTop() const { 559 bool DesktopWindowTreeHostX11::IsAlwaysOnTop() const {
555 return is_always_on_top_; 560 return is_always_on_top_;
556 } 561 }
557 562
558 void DesktopWindowTreeHostX11::SetVisibleOnAllWorkspaces(bool always_visible) { 563 void DesktopWindowTreeHostX11::SetVisibleOnAllWorkspaces(bool always_visible) {
559 SetWMSpecState(always_visible, 564 SetWMSpecState(always_visible,
560 atom_cache_.GetAtom("_NET_WM_STATE_STICKY"), 565 atom_cache_.GetAtom("_NET_WM_STATE_STICKY"),
561 None); 566 None);
567
568 int new_desktop = 0;
569 if (always_visible) {
570 new_desktop = kAllDesktops;
571 } else {
572 if (!ui::GetCurrentDesktop(&new_desktop))
573 return;
574 }
575
576 XEvent xevent;
577 memset (&xevent, 0, sizeof (xevent));
578 xevent.type = ClientMessage;
579 xevent.xclient.window = xwindow_;
580 xevent.xclient.message_type = atom_cache_.GetAtom("_NET_WM_DESKTOP");
581 xevent.xclient.format = 32;
582 xevent.xclient.data.l[0] = new_desktop;
583 xevent.xclient.data.l[1] = 0;
584 xevent.xclient.data.l[2] = 0;
585 xevent.xclient.data.l[3] = 0;
586 xevent.xclient.data.l[4] = 0;
587 XSendEvent(xdisplay_, x_root_window_, False,
588 SubstructureRedirectMask | SubstructureNotifyMask,
589 &xevent);
562 } 590 }
563 591
564 bool DesktopWindowTreeHostX11::SetWindowTitle(const base::string16& title) { 592 bool DesktopWindowTreeHostX11::SetWindowTitle(const base::string16& title) {
565 if (window_title_ == title) 593 if (window_title_ == title)
566 return false; 594 return false;
567 window_title_ = title; 595 window_title_ = title;
568 std::string utf8str = base::UTF16ToUTF8(title); 596 std::string utf8str = base::UTF16ToUTF8(title);
569 XChangeProperty(xdisplay_, 597 XChangeProperty(xdisplay_,
570 xwindow_, 598 xwindow_,
571 atom_cache_.GetAtom("_NET_WM_NAME"), 599 atom_cache_.GetAtom("_NET_WM_NAME"),
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 state_atom_list.push_back( 1099 state_atom_list.push_back(
1072 atom_cache_.GetAtom("_NET_WM_STATE_SKIP_TASKBAR")); 1100 atom_cache_.GetAtom("_NET_WM_STATE_SKIP_TASKBAR"));
1073 } 1101 }
1074 1102
1075 // If the window should stay on top of other windows, add the 1103 // If the window should stay on top of other windows, add the
1076 // _NET_WM_STATE_ABOVE property. 1104 // _NET_WM_STATE_ABOVE property.
1077 is_always_on_top_ = params.keep_on_top; 1105 is_always_on_top_ = params.keep_on_top;
1078 if (is_always_on_top_) 1106 if (is_always_on_top_)
1079 state_atom_list.push_back(atom_cache_.GetAtom("_NET_WM_STATE_ABOVE")); 1107 state_atom_list.push_back(atom_cache_.GetAtom("_NET_WM_STATE_ABOVE"));
1080 1108
1081 if (params.visible_on_all_workspaces) 1109 if (params.visible_on_all_workspaces) {
1082 state_atom_list.push_back(atom_cache_.GetAtom("_NET_WM_STATE_STICKY")); 1110 state_atom_list.push_back(atom_cache_.GetAtom("_NET_WM_STATE_STICKY"));
1111 ui::SetIntProperty(xwindow_, "_NET_WM_DESKTOP", "CARDINAL", kAllDesktops);
1112 }
1083 1113
1084 // Setting _NET_WM_STATE by sending a message to the root_window (with 1114 // Setting _NET_WM_STATE by sending a message to the root_window (with
1085 // SetWMSpecState) has no effect here since the window has not yet been 1115 // SetWMSpecState) has no effect here since the window has not yet been
1086 // mapped. So we manually change the state. 1116 // mapped. So we manually change the state.
1087 if (!state_atom_list.empty()) { 1117 if (!state_atom_list.empty()) {
1088 ui::SetAtomArrayProperty(xwindow_, 1118 ui::SetAtomArrayProperty(xwindow_,
1089 "_NET_WM_STATE", 1119 "_NET_WM_STATE",
1090 "ATOM", 1120 "ATOM",
1091 state_atom_list); 1121 state_atom_list);
1092 } 1122 }
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
1738 if (linux_ui) { 1768 if (linux_ui) {
1739 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); 1769 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window);
1740 if (native_theme) 1770 if (native_theme)
1741 return native_theme; 1771 return native_theme;
1742 } 1772 }
1743 1773
1744 return ui::NativeTheme::instance(); 1774 return ui::NativeTheme::instance();
1745 } 1775 }
1746 1776
1747 } // namespace views 1777 } // namespace views
OLDNEW
« no previous file with comments | « ui/base/x/x11_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698