OLD | NEW |
---|---|
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 #ifndef UI_BASE_X_X11_UTIL_H_ | 5 #ifndef UI_BASE_X_X11_UTIL_H_ |
6 #define UI_BASE_X_X11_UTIL_H_ | 6 #define UI_BASE_X_X11_UTIL_H_ |
7 | 7 |
8 // This file declares utility functions for X11 (Linux only). | 8 // This file declares utility functions for X11 (Linux only). |
9 // | 9 // |
10 // These functions do not require the Xlib headers to be included (which is why | 10 // These functions do not require the Xlib headers to be included (which is why |
(...skipping 11 matching lines...) Expand all Loading... | |
22 #include "ui/events/keycodes/keyboard_codes.h" | 22 #include "ui/events/keycodes/keyboard_codes.h" |
23 #include "ui/gfx/point.h" | 23 #include "ui/gfx/point.h" |
24 #include "ui/gfx/x/x11_types.h" | 24 #include "ui/gfx/x/x11_types.h" |
25 | 25 |
26 typedef unsigned long Atom; | 26 typedef unsigned long Atom; |
27 typedef unsigned long XSharedMemoryId; // ShmSeg in the X headers. | 27 typedef unsigned long XSharedMemoryId; // ShmSeg in the X headers. |
28 typedef unsigned long Cursor; | 28 typedef unsigned long Cursor; |
29 typedef struct _XcursorImage XcursorImage; | 29 typedef struct _XcursorImage XcursorImage; |
30 typedef union _XEvent XEvent; | 30 typedef union _XEvent XEvent; |
31 | 31 |
32 // A process wide singleton cache for X menus. | |
33 template <typename T> struct DefaultSingletonTraits; | |
34 | |
32 #if defined(TOOLKIT_GTK) | 35 #if defined(TOOLKIT_GTK) |
33 typedef struct _GdkDrawable GdkWindow; | 36 typedef struct _GdkDrawable GdkWindow; |
34 typedef struct _GtkWidget GtkWidget; | 37 typedef struct _GtkWidget GtkWidget; |
35 typedef struct _GtkWindow GtkWindow; | 38 typedef struct _GtkWindow GtkWindow; |
36 #endif | 39 #endif |
37 | 40 |
38 namespace gfx { | 41 namespace gfx { |
39 class Canvas; | 42 class Canvas; |
40 class Point; | 43 class Point; |
41 class Rect; | 44 class Rect; |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
391 ::Cursor get() const; | 394 ::Cursor get() const; |
392 void reset(::Cursor cursor); | 395 void reset(::Cursor cursor); |
393 | 396 |
394 private: | 397 private: |
395 ::Cursor cursor_; | 398 ::Cursor cursor_; |
396 XDisplay* display_; | 399 XDisplay* display_; |
397 | 400 |
398 DISALLOW_COPY_AND_ASSIGN(XScopedCursor); | 401 DISALLOW_COPY_AND_ASSIGN(XScopedCursor); |
399 }; | 402 }; |
400 | 403 |
404 // Keeps track of created and destroyed top level menu windows. | |
405 class UI_BASE_EXPORT XMenuList { | |
sadrul
2014/03/26 18:01:07
Let's take it out of here and into a separate file
varkha
2014/03/27 04:48:13
Done.
| |
406 public: | |
407 static XMenuList* GetInstance(); | |
408 | |
409 // Checks if |menu| has _NET_WM_WINDOW_TYPE property set to | |
410 // "_NET_WM_WINDOW_TYPE_MENU" atom and if so caches it. | |
411 void MaybeRegisterMenu(XID menu); | |
412 | |
413 // Finds |menu| in cache and if found removes it. | |
414 void MaybeUnregisterMenu(XID menu); | |
415 | |
416 // Inserts cached menu XIDs at the beginning of |stack|. | |
417 void InsertMenuWindowXIDs(std::vector<XID>* stack); | |
418 | |
419 private: | |
420 friend struct DefaultSingletonTraits<XMenuList>; | |
421 XMenuList(); | |
422 ~XMenuList(); | |
423 | |
424 std::vector<XID> menus_; | |
425 ::Atom menu_type_atom_; | |
426 DISALLOW_COPY_AND_ASSIGN(XMenuList); | |
427 }; | |
428 | |
401 } // namespace ui | 429 } // namespace ui |
402 | 430 |
403 #endif // UI_BASE_X_X11_UTIL_H_ | 431 #endif // UI_BASE_X_X11_UTIL_H_ |
OLD | NEW |