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

Side by Side Diff: ui/ozone/platform/caca/caca_window.h

Issue 387953004: ozone: caca: Convert to PlatformWindow (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase & nits 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/ozone/platform/caca/caca_surface_factory.cc ('k') | ui/ozone/platform/caca/caca_window.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef UI_OZONE_PLATFORM_CACA_CACA_WINDOW_H_
6 #define UI_OZONE_PLATFORM_CACA_CACA_WINDOW_H_
7
8 #include <caca.h>
9
10 #include "base/debug/stack_trace.h"
11 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h"
13 #include "ui/events/platform/platform_event_dispatcher.h"
14 #include "ui/gfx/geometry/size.h"
15 #include "ui/gfx/native_widget_types.h"
16 #include "ui/ozone/platform/caca/scoped_caca_types.h"
17 #include "ui/platform_window/platform_window.h"
18
19 namespace ui {
20
21 class CacaEventFactory;
22 class CacaWindowManager;
23 class PlatformWindowDelegate;
24
25 // Basic initialization of Libcaca. This needs to be shared between SFO and EFO
26 // since both need the |display_| to draw and process events respectively.
27 // Note, |canvas_| needs to be here since it is needed for creating a
28 // |display_|.
29 class CacaWindow : public PlatformWindow, public PlatformEventDispatcher {
30 public:
31 CacaWindow(PlatformWindowDelegate* delegate,
32 CacaWindowManager* manager,
33 CacaEventFactory* event_factory,
34 const gfx::Rect& bounds);
35 virtual ~CacaWindow();
36
37 bool Initialize();
38
39 // Handlers for events received from libcaca.
40 void OnCacaQuit();
41 void OnCacaResize();
42 void OnCacaEvent(ui::Event* event);
43
44 // This is the Caca canvas size.
45 gfx::Size physical_size() const { return physical_size_; }
46 gfx::Size bitmap_size() const { return bitmap_size_; }
47 caca_display_t* display() const { return display_.get(); }
48
49 // PlatformWindow:
50 virtual gfx::Rect GetBounds() OVERRIDE;
51 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
52 virtual void Show() OVERRIDE;
53 virtual void Hide() OVERRIDE;
54 virtual void Close() OVERRIDE;
55 virtual void SetCapture() OVERRIDE;
56 virtual void ReleaseCapture() OVERRIDE;
57 virtual void ToggleFullscreen() OVERRIDE;
58 virtual void Maximize() OVERRIDE;
59 virtual void Minimize() OVERRIDE;
60 virtual void Restore() OVERRIDE;
61
62 // PlatformEventDispatcher:
63 virtual bool CanDispatchEvent(const PlatformEvent& event) OVERRIDE;
64 virtual uint32_t DispatchEvent(const PlatformEvent& event) OVERRIDE;
65
66 private:
67 // Event polling.
68 void TryProcessingEvent();
69
70 // Sync sizes with libcaca.
71 void UpdateDisplaySize();
72
73 PlatformWindowDelegate* delegate_;
74 CacaWindowManager* manager_;
75 CacaEventFactory* event_factory_;
76 gfx::AcceleratedWidget widget_;
77
78 ScopedCacaCanvas canvas_;
79 ScopedCacaDisplay display_;
80
81 // Size of the console in characters. This can be changed by setting
82 // CACA_GEOMETRY environment variable.
83 gfx::Size physical_size_;
84
85 // Size of the backing buffer we draw into. Size in pixels.
86 gfx::Size bitmap_size_;
87
88 base::WeakPtrFactory<CacaWindow> weak_ptr_factory_;
89
90 DISALLOW_COPY_AND_ASSIGN(CacaWindow);
91 };
92
93 } // namespace ui
94
95 #endif // UI_OZONE_PLATFORM_CACA_CACA_WINDOW_H_
OLDNEW
« no previous file with comments | « ui/ozone/platform/caca/caca_surface_factory.cc ('k') | ui/ozone/platform/caca/caca_window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698