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

Unified Diff: ui/views/widget/desktop_aura/x11_desktop_handler.cc

Issue 397223002: Enable copying long text to Chrome and pasting long text from Chrome (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/widget/desktop_aura/x11_desktop_handler.cc
diff --git a/ui/views/widget/desktop_aura/x11_desktop_handler.cc b/ui/views/widget/desktop_aura/x11_desktop_handler.cc
index c8a53f8991404b2653ea38e8046ae102b1a8a34b..d32192b27be50aa19c72d7ca84314481a5f4435b 100644
--- a/ui/views/widget/desktop_aura/x11_desktop_handler.cc
+++ b/ui/views/widget/desktop_aura/x11_desktop_handler.cc
@@ -10,6 +10,7 @@
#include "base/message_loop/message_loop.h"
#include "ui/aura/env.h"
#include "ui/aura/window_event_dispatcher.h"
+#include "ui/base/x/x11_foreign_window_manager.h"
#include "ui/base/x/x11_menu_list.h"
#include "ui/base/x/x11_util.h"
#include "ui/events/platform/platform_event_source.h"
@@ -167,26 +168,12 @@ uint32_t X11DesktopHandler::DispatchEvent(const ui::PlatformEvent& event) {
break;
}
- // Menus created by Chrome can be drag and drop targets. Since they are
- // direct children of the screen root window and have override_redirect
- // we cannot use regular _NET_CLIENT_LIST_STACKING property to find them
- // and use a separate cache to keep track of them.
- // TODO(varkha): Implement caching of all top level X windows and their
- // coordinates and stacking order to eliminate repeated calls to X server
- // during mouse movement, drag and shaping events.
- case CreateNotify: {
- // The window might be destroyed if the message pump haven't gotten a
- // chance to run but we can safely ignore the X error.
- gfx::X11ErrorTracker error_tracker;
- XCreateWindowEvent *xcwe = &event->xcreatewindow;
- ui::XMenuList::GetInstance()->MaybeRegisterMenu(xcwe->window);
+ case CreateNotify:
+ OnWindowCreatedOrDestroyed(event->type, event->xcreatewindow.window);
break;
- }
- case DestroyNotify: {
- XDestroyWindowEvent *xdwe = &event->xdestroywindow;
- ui::XMenuList::GetInstance()->MaybeUnregisterMenu(xdwe->window);
+ case DestroyNotify:
+ OnWindowCreatedOrDestroyed(event->type, event->xdestroywindow.window);
break;
- }
default:
NOTREACHED();
}
@@ -226,4 +213,28 @@ void X11DesktopHandler::OnActiveWindowChanged(::Window xid,
}
}
+void X11DesktopHandler::OnWindowCreatedOrDestroyed(int event_type,
+ XID window) {
+ // Menus created by Chrome can be drag and drop targets. Since they are
+ // direct children of the screen root window and have override_redirect
+ // we cannot use regular _NET_CLIENT_LIST_STACKING property to find them
+ // and use a separate cache to keep track of them.
+ // TODO(varkha): Implement caching of all top level X windows and their
+ // coordinates and stacking order to eliminate repeated calls to the X server
+ // during mouse movement, drag and shaping events.
+ if (event_type == CreateNotify) {
+ // The window might be destroyed if the message pump did not get a chance to
+ // run but we can safely ignore the X error.
+ gfx::X11ErrorTracker error_tracker;
+ ui::XMenuList::GetInstance()->MaybeRegisterMenu(window);
+ } else {
+ ui::XMenuList::GetInstance()->MaybeUnregisterMenu(window);
+ }
+
+ if (event_type == DestroyNotify) {
+ // Notify the XForeignWindowManager that |window| has been destroyed.
+ ui::XForeignWindowManager::GetInstance()->OnWindowDestroyed(window);
+ }
+}
+
} // namespace views
« ui/base/x/x11_foreign_window_manager.cc ('K') | « ui/views/widget/desktop_aura/x11_desktop_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698