summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorscribam <scribam@users.noreply.github.com>2017-09-20 22:39:49 +0200
committerscribam <scribam@users.noreply.github.com>2017-09-20 23:29:39 +0200
commitb6e7e66fbe9831a3e20551ad19dc942dfb6eab59 (patch)
tree1479d13ff511cea2d4f4c2f2921e78596bf890dc
parentfa3edace6a91fdd03f272993b1a30d762ee1221b (diff)
Fix travis LINT
-rw-r--r--src/xenia/base/exception_handler_linux.cc5
-rw-r--r--src/xenia/base/filesystem_posix.cc33
-rw-r--r--src/xenia/base/math.h2
-rw-r--r--src/xenia/base/platform_linux.cc1
-rw-r--r--src/xenia/base/platform_linux.h10
-rw-r--r--src/xenia/base/threading.h2
-rw-r--r--src/xenia/base/threading_linux.cc5
-rw-r--r--src/xenia/base/threading_posix.cc97
-rw-r--r--src/xenia/cpu/compiler/passes/data_flow_analysis_pass.cc2
-rw-r--r--src/xenia/cpu/compiler/passes/value_reduction_pass.cc2
-rw-r--r--src/xenia/gpu/command_processor.h1
-rw-r--r--src/xenia/gpu/gl4/gl4_shader_cache.h2
-rw-r--r--src/xenia/gpu/vulkan/render_cache.cc6
-rw-r--r--src/xenia/ui/file_picker_gtk.cc35
-rw-r--r--src/xenia/ui/gl/gl_context.cc8
-rw-r--r--src/xenia/ui/gl/gl_context.h6
-rw-r--r--src/xenia/ui/gl/gl_context_win.cc11
-rw-r--r--src/xenia/ui/gl/gl_context_win.h13
-rw-r--r--src/xenia/ui/gl/gl_context_x11.cc31
-rw-r--r--src/xenia/ui/gl/gl_context_x11.h15
-rw-r--r--src/xenia/ui/loop_gtk.cc29
-rw-r--r--src/xenia/ui/loop_gtk.h4
-rw-r--r--src/xenia/ui/menu_item.h2
-rw-r--r--src/xenia/ui/vulkan/vulkan_context.cc11
-rw-r--r--src/xenia/ui/vulkan/vulkan_instance.cc15
-rw-r--r--src/xenia/ui/window_gtk.cc67
-rw-r--r--src/xenia/ui/window_gtk.h15
27 files changed, 174 insertions, 256 deletions
diff --git a/src/xenia/base/exception_handler_linux.cc b/src/xenia/base/exception_handler_linux.cc
index 16fc669ad..bc656a15d 100644
--- a/src/xenia/base/exception_handler_linux.cc
+++ b/src/xenia/base/exception_handler_linux.cc
@@ -24,13 +24,12 @@ constexpr size_t kMaxHandlerCount = 8;
// Executed in order.
std::pair<ExceptionHandler::Handler, void*> handlers_[kMaxHandlerCount];
-
void ExceptionHandler::Install(Handler fn, void* data) {
- //TODO(dougvj) stub
+ // TODO(dougvj) stub
}
void ExceptionHandler::Uninstall(Handler fn, void* data) {
- //TODO(dougvj) stub
+ // TODO(dougvj) stub
}
} // namespace xe
diff --git a/src/xenia/base/filesystem_posix.cc b/src/xenia/base/filesystem_posix.cc
index dd3f885d0..a948717cc 100644
--- a/src/xenia/base/filesystem_posix.cc
+++ b/src/xenia/base/filesystem_posix.cc
@@ -12,11 +12,11 @@
#include "xenia/base/string.h"
#include <dirent.h>
+#include <fcntl.h>
+#include <ftw.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
-#include <ftw.h>
-#include <fcntl.h>
namespace xe {
namespace filesystem {
@@ -26,7 +26,6 @@ bool PathExists(const std::wstring& path) {
return stat(xe::to_string(path).c_str(), &st) == 0;
}
-
FILE* OpenFile(const std::wstring& path, const char* mode) {
auto fixed_path = xe::fix_path_separators(path);
return fopen(xe::to_string(fixed_path).c_str(), mode);
@@ -36,23 +35,25 @@ bool CreateFolder(const std::wstring& path) {
return mkdir(xe::to_string(path).c_str(), 0774);
}
-static int removeCallback(const char *fpath, const struct stat* sb,
- int typeflag, struct FTW* ftwbuf) {
+static int removeCallback(const char* fpath, const struct stat* sb,
+ int typeflag, struct FTW* ftwbuf) {
int rv = remove(fpath);
return rv;
}
bool DeleteFolder(const std::wstring& path) {
return nftw(xe::to_string(path).c_str(), removeCallback, 64,
- FTW_DEPTH | FTW_PHYS) == 0 ? true : false;
+ FTW_DEPTH | FTW_PHYS) == 0
+ ? true
+ : false;
}
static uint64_t convertUnixtimeToWinFiletime(time_t unixtime) {
- //Linux uses number of seconds since 1/1/1970, and Windows uses
- //number of nanoseconds since 1/1/1601
- //so we convert linux time to nanoseconds and then add the number of
- //nanoseconds from 1601 to 1970
- //see https://msdn.microsoft.com/en-us/library/ms724228
+ // Linux uses number of seconds since 1/1/1970, and Windows uses
+ // number of nanoseconds since 1/1/1601
+ // so we convert linux time to nanoseconds and then add the number of
+ // nanoseconds from 1601 to 1970
+ // see https://msdn.microsoft.com/en-us/library/ms724228
uint64_t filetime = filetime = (unixtime * 10000000) + 116444736000000000;
return filetime;
}
@@ -60,8 +61,7 @@ static uint64_t convertUnixtimeToWinFiletime(time_t unixtime) {
bool IsFolder(const std::wstring& path) {
struct stat st;
if (stat(xe::to_string(path).c_str(), &st) == 0) {
- if (S_ISDIR(st.st_mode))
- return true;
+ if (S_ISDIR(st.st_mode)) return true;
}
return false;
}
@@ -89,11 +89,9 @@ class PosixFileHandle : public FileHandle {
}
bool Read(size_t file_offset, void* buffer, size_t buffer_length,
size_t* out_bytes_read) override {
-
ssize_t out = pread(handle_, buffer, buffer_length, file_offset);
*out_bytes_read = out;
return out >= 0 ? true : false;
-
}
bool Write(size_t file_offset, const void* buffer, size_t buffer_length,
size_t* out_bytes_written) override {
@@ -144,8 +142,7 @@ bool GetInfo(const std::wstring& path, FileInfo* out_info) {
if (stat(xe::to_string(path).c_str(), &st) == 0) {
if (S_ISDIR(st.st_mode)) {
out_info->type = FileInfo::Type::kDirectory;
- }
- else {
+ } else {
out_info->type = FileInfo::Type::kFile;
}
out_info->create_timestamp = convertUnixtimeToWinFiletime(st.st_ctime);
@@ -186,7 +183,5 @@ std::vector<FileInfo> ListFiles(const std::wstring& path) {
return result;
}
-
} // namespace filesystem
} // namespace xe
-
diff --git a/src/xenia/base/math.h b/src/xenia/base/math.h
index 2e87d87d5..d2c58ee3a 100644
--- a/src/xenia/base/math.h
+++ b/src/xenia/base/math.h
@@ -11,10 +11,10 @@
#define XENIA_BASE_MATH_H_
#include <algorithm>
+#include <cmath>
#include <cstdint>
#include <cstring>
#include <type_traits>
-#include <cmath>
#include "xenia/base/platform.h"
#if XE_ARCH_AMD64
diff --git a/src/xenia/base/platform_linux.cc b/src/xenia/base/platform_linux.cc
index 053cbd7c4..b90c6f78e 100644
--- a/src/xenia/base/platform_linux.cc
+++ b/src/xenia/base/platform_linux.cc
@@ -18,5 +18,4 @@ void LaunchBrowser(const char* url) {
system(cmd.c_str());
}
-
} // namespace xe
diff --git a/src/xenia/base/platform_linux.h b/src/xenia/base/platform_linux.h
index 2f995e918..345be94ab 100644
--- a/src/xenia/base/platform_linux.h
+++ b/src/xenia/base/platform_linux.h
@@ -18,15 +18,15 @@
// Xlib/Xcb is used only for GLX/Vulkan interaction, the window management
// and input events are done with gtk/gdk
-#include <X11/Xlib.h>
#include <X11/Xlib-xcb.h>
-#include <X11/Xutil.h>
+#include <X11/Xlib.h>
#include <X11/Xos.h>
+#include <X11/Xutil.h>
#include <xcb/xcb.h>
-//Used for window management. Gtk is for GUI and wigets, gdk is for lower
-//level events like key presses, mouse events, window handles, etc
-#include <gtk/gtk.h>
+// Used for window management. Gtk is for GUI and wigets, gdk is for lower
+// level events like key presses, mouse events, window handles, etc
#include <gdk/gdkx.h>
+#include <gtk/gtk.h>
#endif // XENIA_BASE_PLATFORM_X11_H_
diff --git a/src/xenia/base/threading.h b/src/xenia/base/threading.h
index bb447f282..480b76207 100644
--- a/src/xenia/base/threading.h
+++ b/src/xenia/base/threading.h
@@ -16,13 +16,13 @@
#include <climits>
#include <condition_variable>
#include <cstdint>
+#include <functional>
#include <memory>
#include <mutex>
#include <string>
#include <thread>
#include <utility>
#include <vector>
-#include <functional>
namespace xe {
namespace threading {
diff --git a/src/xenia/base/threading_linux.cc b/src/xenia/base/threading_linux.cc
index 21d5418c7..3535f3011 100644
--- a/src/xenia/base/threading_linux.cc
+++ b/src/xenia/base/threading_linux.cc
@@ -13,8 +13,5 @@
#include <time.h>
namespace xe {
-namespace threading {
-
-
-} // namespace threading
+namespace threading {} // namespace threading
} // namespace xe
diff --git a/src/xenia/base/threading_posix.cc b/src/xenia/base/threading_posix.cc
index 1a0bea457..c8d6f6654 100644
--- a/src/xenia/base/threading_posix.cc
+++ b/src/xenia/base/threading_posix.cc
@@ -14,18 +14,16 @@
#include <pthread.h>
#include <sys/syscall.h>
-#include <sys/types.h>
#include <sys/time.h>
+#include <sys/types.h>
#include <time.h>
#include <unistd.h>
namespace xe {
namespace threading {
-//TODO(dougvj)
-void EnableAffinityConfiguration() {
-
-}
+// TODO(dougvj)
+void EnableAffinityConfiguration() {}
// uint64_t ticks() { return mach_absolute_time(); }
@@ -46,9 +44,7 @@ void MaybeYield() {
__sync_synchronize();
}
-void SyncMemory() {
- __sync_synchronize();
-}
+void SyncMemory() { __sync_synchronize(); }
void Sleep(std::chrono::microseconds duration) {
timespec rqtp = {time_t(duration.count() / 1000000),
@@ -57,35 +53,28 @@ void Sleep(std::chrono::microseconds duration) {
// TODO(benvanik): spin while rmtp >0?
}
-//TODO(dougvj) Not sure how to implement the equivalent of this on POSIX.
+// TODO(dougvj) Not sure how to implement the equivalent of this on POSIX.
SleepResult AlertableSleep(std::chrono::microseconds duration) {
sleep(duration.count() / 1000);
return SleepResult::kSuccess;
}
-//TODO(dougvj) We can probably wrap this with pthread_key_t but the type of
-//TlsHandle probably needs to be refactored
-TlsHandle AllocateTlsHandle() {
- assert_always();
-}
+// TODO(dougvj) We can probably wrap this with pthread_key_t but the type of
+// TlsHandle probably needs to be refactored
+TlsHandle AllocateTlsHandle() { assert_always(); }
bool FreeTlsHandle(TlsHandle handle) { return true; }
-uintptr_t GetTlsValue(TlsHandle handle) {
- assert_always();
-}
+uintptr_t GetTlsValue(TlsHandle handle) { assert_always(); }
-bool SetTlsValue(TlsHandle handle, uintptr_t value) {
- assert_always();
-}
+bool SetTlsValue(TlsHandle handle, uintptr_t value) { assert_always(); }
-//TODO(dougvj)
+// TODO(dougvj)
class PosixHighResolutionTimer : public HighResolutionTimer {
public:
PosixHighResolutionTimer(std::function<void()> callback)
: callback_(callback) {}
- ~PosixHighResolutionTimer() override {
- }
+ ~PosixHighResolutionTimer() override {}
bool Initialize(std::chrono::milliseconds period) {
assert_always();
@@ -111,7 +100,7 @@ std::unique_ptr<HighResolutionTimer> HighResolutionTimer::CreateRepeating(
// some more functionality
class PosixCondition {
public:
- PosixCondition(): signal_(false) {
+ PosixCondition() : signal_(false) {
pthread_mutex_init(&mutex_, NULL);
pthread_cond_init(&cond_, NULL);
}
@@ -135,7 +124,7 @@ class PosixCondition {
}
bool Wait(unsigned int timeout_ms) {
- //Assume 0 means no timeout, not instant timeout
+ // Assume 0 means no timeout, not instant timeout
if (timeout_ms == 0) {
Wait();
}
@@ -143,42 +132,40 @@ class PosixCondition {
struct timeval now;
gettimeofday(&now, NULL);
- //Add the number of seconds we want to wait to the current time
- time_to_wait.tv_sec = now.tv_sec + (timeout_ms/1000);
- //Add the number of nanoseconds we want to wait to the current nanosecond
- //stride
- long nsec = (now.tv_usec+(timeout_ms % 1000)) * 1000;
- //If we overflowed the nanosecond count then we add a second
- time_to_wait.tv_sec += nsec/1000000000UL;
- //We only add nanoseconds within the 1 second stride
+ // Add the number of seconds we want to wait to the current time
+ time_to_wait.tv_sec = now.tv_sec + (timeout_ms / 1000);
+ // Add the number of nanoseconds we want to wait to the current nanosecond
+ // stride
+ long nsec = (now.tv_usec + (timeout_ms % 1000)) * 1000;
+ // If we overflowed the nanosecond count then we add a second
+ time_to_wait.tv_sec += nsec / 1000000000UL;
+ // We only add nanoseconds within the 1 second stride
time_to_wait.tv_nsec = nsec % 1000000000UL;
pthread_mutex_lock(&mutex_);
- while(!signal_) {
+ while (!signal_) {
int status = pthread_cond_timedwait(&cond_, &mutex_, &time_to_wait);
- if (status == ETIMEDOUT)
- return false; //We timed out
+ if (status == ETIMEDOUT) return false; // We timed out
}
pthread_mutex_unlock(&mutex_);
- return true; //We didn't time out
+ return true; // We didn't time out
}
bool Wait() {
pthread_mutex_lock(&mutex_);
- while(!signal_) {
+ while (!signal_) {
pthread_cond_wait(&cond_, &mutex_);
}
pthread_mutex_unlock(&mutex_);
- return true; //Did not time out;
+ return true; // Did not time out;
}
private:
bool signal_;
pthread_cond_t cond_;
pthread_mutex_t mutex_;
-
};
-//Native posix thread handle
+// Native posix thread handle
template <typename T>
class PosixThreadHandle : public T {
public:
@@ -193,8 +180,8 @@ class PosixThreadHandle : public T {
pthread_t handle_;
};
-//This is wraps a condition object as our handle because posix has no single
-//native handle for higher level concurrency constructs such as semaphores
+// This is wraps a condition object as our handle because posix has no single
+// native handle for higher level concurrency constructs such as semaphores
template <typename T>
class PosixConditionHandle : public T {
public:
@@ -208,10 +195,9 @@ class PosixConditionHandle : public T {
PosixCondition handle_;
};
-
// TODO(dougvj)
WaitResult Wait(WaitHandle* wait_handle, bool is_alertable,
- std::chrono::milliseconds timeout) {
+ std::chrono::milliseconds timeout) {
assert_always();
return WaitResult::kFailed;
}
@@ -233,15 +219,15 @@ std::pair<WaitResult, size_t> WaitMultiple(WaitHandle* wait_handles[],
return std::pair<WaitResult, size_t>(WaitResult::kFailed, 0);
}
-
-//TODO(dougvj)
-class PosixEvent: public PosixConditionHandle<Event> {
+// TODO(dougvj)
+class PosixEvent : public PosixConditionHandle<Event> {
public:
PosixEvent(bool initial_state, int auto_reset) { assert_always(); }
~PosixEvent() override = default;
void Set() override { assert_always(); }
void Reset() override { assert_always(); }
void Pulse() override { assert_always(); }
+
private:
PosixCondition condition_;
};
@@ -254,7 +240,7 @@ std::unique_ptr<Event> Event::CreateAutoResetEvent(bool initial_state) {
return std::make_unique<PosixEvent>(PosixEvent(initial_state, true));
}
-//TODO(dougvj)
+// TODO(dougvj)
class PosixSemaphore : public PosixConditionHandle<Semaphore> {
public:
PosixSemaphore(int initial_count, int maximum_count) { assert_always(); }
@@ -270,22 +256,22 @@ std::unique_ptr<Semaphore> Semaphore::Create(int initial_count,
return std::make_unique<PosixSemaphore>(initial_count, maximum_count);
}
-//TODO(dougvj)
+// TODO(dougvj)
class PosixMutant : public PosixConditionHandle<Mutant> {
public:
- PosixMutant(bool initial_owner) {
+ PosixMutant(bool initial_owner) { assert_always(); }
+ ~PosixMutant() = default;
+ bool Release() override {
assert_always();
+ return false;
}
- ~PosixMutant() = default;
- bool Release() override { assert_always(); return false; }
- private:
};
std::unique_ptr<Mutant> Mutant::Create(bool initial_owner) {
return std::make_unique<PosixMutant>(initial_owner);
}
-//TODO(dougvj)
+// TODO(dougvj)
class PosixTimer : public PosixConditionHandle<Timer> {
public:
PosixTimer(bool manual_reset) { assert_always(); }
@@ -305,7 +291,6 @@ class PosixTimer : public PosixConditionHandle<Timer> {
assert_always();
return false;
}
-
};
std::unique_ptr<Timer> Timer::CreateManualResetTimer() {
diff --git a/src/xenia/cpu/compiler/passes/data_flow_analysis_pass.cc b/src/xenia/cpu/compiler/passes/data_flow_analysis_pass.cc
index 5f403c738..622af656b 100644
--- a/src/xenia/cpu/compiler/passes/data_flow_analysis_pass.cc
+++ b/src/xenia/cpu/compiler/passes/data_flow_analysis_pass.cc
@@ -23,8 +23,8 @@
#include <llvm/ADT/BitVector.h>
#pragma warning(pop)
#else
-#include <cmath>
#include <llvm/ADT/BitVector.h>
+#include <cmath>
#endif // XE_COMPILER_MSVC
namespace xe {
diff --git a/src/xenia/cpu/compiler/passes/value_reduction_pass.cc b/src/xenia/cpu/compiler/passes/value_reduction_pass.cc
index 635290d67..02ec9e757 100644
--- a/src/xenia/cpu/compiler/passes/value_reduction_pass.cc
+++ b/src/xenia/cpu/compiler/passes/value_reduction_pass.cc
@@ -22,8 +22,8 @@
#include <llvm/ADT/BitVector.h>
#pragma warning(pop)
#else
-#include <cmath>
#include <llvm/ADT/BitVector.h>
+#include <cmath>
#endif // XE_COMPILER_MSVC
namespace xe {
diff --git a/src/xenia/gpu/command_processor.h b/src/xenia/gpu/command_processor.h
index e8f7fffec..a418dd683 100644
--- a/src/xenia/gpu/command_processor.h
+++ b/src/xenia/gpu/command_processor.h
@@ -240,4 +240,3 @@ class CommandProcessor {
} // namespace xe
#endif // XENIA_GPU_COMMAND_PROCESSOR_H_
-
diff --git a/src/xenia/gpu/gl4/gl4_shader_cache.h b/src/xenia/gpu/gl4/gl4_shader_cache.h
index 59eaf665e..9c5c77cb2 100644
--- a/src/xenia/gpu/gl4/gl4_shader_cache.h
+++ b/src/xenia/gpu/gl4/gl4_shader_cache.h
@@ -11,10 +11,10 @@
#define XENIA_GPU_GL4_SHADER_CACHE_H_
#include <cstdint>
-#include <vector>
#include <cstring>
#include <memory>
#include <unordered_map>
+#include <vector>
#include "xenia/gpu/xenos.h"
diff --git a/src/xenia/gpu/vulkan/render_cache.cc b/src/xenia/gpu/vulkan/render_cache.cc
index 90729bde3..d3a4b5a66 100644
--- a/src/xenia/gpu/vulkan/render_cache.cc
+++ b/src/xenia/gpu/vulkan/render_cache.cc
@@ -761,7 +761,7 @@ bool RenderCache::ParseConfiguration(RenderConfiguration* config) {
config->color[i].format = ColorRenderTargetFormat::k_2_10_10_10_FLOAT;
break;
default:
- //The rest are good
+ // The rest are good
break;
}
}
@@ -1149,7 +1149,7 @@ void RenderCache::BlitToImage(VkCommandBuffer command_buffer,
format = uint32_t(ColorRenderTargetFormat::k_2_10_10_10_FLOAT);
break;
default:
- //Rest are OK
+ // Rest are OK
break;
}
}
@@ -1265,7 +1265,7 @@ void RenderCache::ClearEDRAMColor(VkCommandBuffer command_buffer,
format = ColorRenderTargetFormat::k_2_10_10_10_FLOAT;
break;
default:
- //Rest are OK
+ // Rest are OK
break;
}
diff --git a/src/xenia/ui/file_picker_gtk.cc b/src/xenia/ui/file_picker_gtk.cc
index 8dc52eadc..dce28772d 100644
--- a/src/xenia/ui/file_picker_gtk.cc
+++ b/src/xenia/ui/file_picker_gtk.cc
@@ -9,11 +9,11 @@
#include "xenia/ui/file_picker.h"
-#include "xenia/base/assert.h"
-#include "xenia/base/platform_linux.h"
-#include <locale>
#include <codecvt>
+#include <locale>
#include <string>
+#include "xenia/base/assert.h"
+#include "xenia/base/platform_linux.h"
namespace xe {
namespace ui {
@@ -36,39 +36,34 @@ GtkFilePicker::GtkFilePicker() = default;
GtkFilePicker::~GtkFilePicker() = default;
-
bool GtkFilePicker::Show(void* parent_window_handle) {
// TODO(benvanik): FileSaveDialog.
assert_true(mode() == Mode::kOpen);
// TODO(benvanik): folder dialogs.
assert_true(type() == Type::kFile);
- GtkWidget *dialog;
+ GtkWidget* dialog;
gint res;
- dialog = gtk_file_chooser_dialog_new ("Open File",
- (GtkWindow*)parent_window_handle,
- GTK_FILE_CHOOSER_ACTION_OPEN,
- "_Cancel",
- GTK_RESPONSE_CANCEL,
- "_Open",
- GTK_RESPONSE_ACCEPT,
- NULL);
+ dialog = gtk_file_chooser_dialog_new(
+ "Open File", (GtkWindow*)parent_window_handle,
+ GTK_FILE_CHOOSER_ACTION_OPEN, "_Cancel", GTK_RESPONSE_CANCEL, "_Open",
+ GTK_RESPONSE_ACCEPT, NULL);
- res = gtk_dialog_run (GTK_DIALOG (dialog));
- char *filename;
+ res = gtk_dialog_run(GTK_DIALOG(dialog));
+ char* filename;
if (res == GTK_RESPONSE_ACCEPT) {
- GtkFileChooser *chooser = GTK_FILE_CHOOSER (dialog);
- filename = gtk_file_chooser_get_filename (chooser);
+ GtkFileChooser* chooser = GTK_FILE_CHOOSER(dialog);
+ filename = gtk_file_chooser_get_filename(chooser);
std::vector<std::wstring> selected_files;
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
std::wstring ws_filename = converter.from_bytes(filename);
selected_files.push_back(ws_filename);
set_selected_files(selected_files);
- gtk_widget_destroy (dialog);
+ gtk_widget_destroy(dialog);
return true;
}
- gtk_widget_destroy (dialog);
- return false;;
+ gtk_widget_destroy(dialog);
+ return false;
}
} // namespace ui
diff --git a/src/xenia/ui/gl/gl_context.cc b/src/xenia/ui/gl/gl_context.cc
index 24c4f75ce..a1c94ef9e 100644
--- a/src/xenia/ui/gl/gl_context.cc
+++ b/src/xenia/ui/gl/gl_context.cc
@@ -21,7 +21,6 @@
#include "xenia/ui/gl/gl_immediate_drawer.h"
#include "xenia/ui/window.h"
-
DEFINE_bool(thread_safe_gl, false,
"Only allow one GL context to be active at a time.");
@@ -40,7 +39,6 @@ namespace xe {
namespace ui {
namespace gl {
-
std::recursive_mutex GLContext::global_gl_mutex_;
void GLContext::FatalGLError(std::string error) {
@@ -51,10 +49,8 @@ void GLContext::FatalGLError(std::string error) {
"of supported GPUs.");
}
-
-
GLContext::GLContext(GraphicsProvider* provider, Window* target_window)
- : GraphicsContext(provider, target_window) { }
+ : GraphicsContext(provider, target_window) {}
GLContext::~GLContext() {}
@@ -218,8 +214,6 @@ ImmediateDrawer* GLContext::immediate_drawer() {
return immediate_drawer_.get();
}
-
-
bool GLContext::WasLost() {
if (!robust_access_supported_) {
// Can't determine if we lost the context.
diff --git a/src/xenia/ui/gl/gl_context.h b/src/xenia/ui/gl/gl_context.h
index 8e49b80df..d71e209b2 100644
--- a/src/xenia/ui/gl/gl_context.h
+++ b/src/xenia/ui/gl/gl_context.h
@@ -29,7 +29,6 @@ DECLARE_bool(gl_debug);
DECLARE_bool(gl_debug_output);
DECLARE_bool(gl_debug_output_synchronous);
-
namespace xe {
namespace ui {
namespace gl {
@@ -69,6 +68,7 @@ class GLContext : public GraphicsContext {
void AssertExtensionsPresent();
void DebugMessage(GLenum source, GLenum type, GLuint id, GLenum severity,
GLsizei length, const GLchar* message);
+
private:
friend class GLProvider;
@@ -79,15 +79,11 @@ class GLContext : public GraphicsContext {
GLContext* parent_context);
private:
-
-
static void GLAPIENTRY DebugMessageThunk(GLenum source, GLenum type,
GLuint id, GLenum severity,
GLsizei length,
const GLchar* message,
GLvoid* user_param);
-
-
};
} // namespace gl
diff --git a/src/xenia/ui/gl/gl_context_win.cc b/src/xenia/ui/gl/gl_context_win.cc
index c48e4a55e..0ca66146c 100644
--- a/src/xenia/ui/gl/gl_context_win.cc
+++ b/src/xenia/ui/gl/gl_context_win.cc
@@ -24,23 +24,20 @@
#include "third_party/GL/wglew.h"
-
namespace xe {
namespace ui {
namespace gl {
-
thread_local GLEWContext* tls_glew_context_ = nullptr;
thread_local WGLEWContext* tls_wglew_context_ = nullptr;
extern "C" GLEWContext* glewGetContext() { return tls_glew_context_; }
extern "C" WGLEWContext* wglewGetContext() { return tls_wglew_context_; }
-
std::unique_ptr<GLContext> GLContext::Create(GraphicsProvider* provider,
Window* target_window,
GLContext* share_context) {
auto context =
- std::unique_ptr<GLContext>(new WGLContext(provider, target_window));
+ std::unique_ptr<GLContext>(new WGLContext(provider, target_window));
if (!context->Initialize(share_context)) {
return nullptr;
}
@@ -48,11 +45,10 @@ std::unique_ptr<GLContext> GLContext::Create(GraphicsProvider* provider,
return context;
}
-
std::unique_ptr<GLContext> GLContext::CreateOffscreen(
- GraphicsProvider* provider, GLContext* parent_context) {
+ GraphicsProvider* provider, GLContext* parent_context) {
return WGLContext::CreateOffscreen(provider,
- static_cast<WGLContext*>(parent_context));
+ static_cast<WGLContext*>(parent_context));
}
WGLContext::WGLContext(GraphicsProvider* provider, Window* target_window)
@@ -296,7 +292,6 @@ void WGLContext::ClearCurrent() {
}
}
-
void WGLContext::BeginSwap() {
SCOPE_profile_cpu_i("gpu", "xe::ui::gl::WGLContext::BeginSwap");
float clear_color[] = {238 / 255.0f, 238 / 255.0f, 238 / 255.0f, 1.0f};
diff --git a/src/xenia/ui/gl/gl_context_win.h b/src/xenia/ui/gl/gl_context_win.h
index 392418f81..772de4d3e 100644
--- a/src/xenia/ui/gl/gl_context_win.h
+++ b/src/xenia/ui/gl/gl_context_win.h
@@ -14,9 +14,9 @@
#include <memory>
-#include "xenia/ui/gl/gl_context.h"
#include "xenia/ui/gl/blitter.h"
#include "xenia/ui/gl/gl.h"
+#include "xenia/ui/gl/gl_context.h"
#include "xenia/ui/graphics_context.h"
typedef struct HDC__* HDC;
@@ -33,7 +33,6 @@ class WGLContext : public GLContext {
public:
~WGLContext() override;
-
bool is_current() override;
bool MakeCurrent() override;
void ClearCurrent() override;
@@ -41,25 +40,21 @@ class WGLContext : public GLContext {
void BeginSwap() override;
void EndSwap() override;
-
protected:
friend class GLContext;
WGLContext(GraphicsProvider* provider, Window* target_window);
- static std::unique_ptr<WGLContext> CreateOffscreen(GraphicsProvider* provider,
- WGLContext* parent_context);
+ static std::unique_ptr<WGLContext> CreateOffscreen(
+ GraphicsProvider* provider, WGLContext* parent_context);
bool Initialize(GLContext* share_context) override;
- void* handle() override {return glrc_;};
+ void* handle() override { return glrc_; }
private:
-
-
HDC dc_ = nullptr;
HGLRC glrc_ = nullptr;
std::unique_ptr<GLEWContext> glew_context_;
std::unique_ptr<WGLEWContext> wglew_context_;
-
};
} // namespace gl
diff --git a/src/xenia/ui/gl/gl_context_x11.cc b/src/xenia/ui/gl/gl_context_x11.cc
index bc35685da..fc4b3176b 100644
--- a/src/xenia/ui/gl/gl_context_x11.cc
+++ b/src/xenia/ui/gl/gl_context_x11.cc
@@ -11,9 +11,11 @@
#include <gflags/gflags.h>
+#include <gdk/gdkx.h>
#include <mutex>
#include <string>
+#include "third_party/GL/glxew.h"
#include "xenia/base/assert.h"
#include "xenia/base/logging.h"
#include "xenia/base/math.h"
@@ -21,27 +23,21 @@
#include "xenia/base/profiling.h"
#include "xenia/ui/gl/gl_immediate_drawer.h"
#include "xenia/ui/window.h"
-#include "third_party/GL/glxew.h"
-#include <gdk/gdkx.h>
namespace xe {
namespace ui {
namespace gl {
-
-
thread_local GLEWContext* tls_glew_context_ = nullptr;
thread_local GLXEWContext* tls_glxew_context_ = nullptr;
extern "C" GLEWContext* glewGetContext() { return tls_glew_context_; }
extern "C" GLXEWContext* glxewGetContext() { return tls_glxew_context_; }
-
-
std::unique_ptr<GLContext> GLContext::Create(GraphicsProvider* provider,
Window* target_window,
GLContext* share_context) {
auto context =
- std::unique_ptr<GLContext>(new GLXContext(provider, target_window));
+ std::unique_ptr<GLContext>(new GLXContext(provider, target_window));
if (!context->Initialize(share_context)) {
return nullptr;
}
@@ -50,9 +46,9 @@ std::unique_ptr<GLContext> GLContext::Create(GraphicsProvider* provider,
}
std::unique_ptr<GLContext> GLContext::CreateOffscreen(
- GraphicsProvider* provider, GLContext* parent_context) {
+ GraphicsProvider* provider, GLContext* parent_context) {
return GLXContext::CreateOffscreen(provider,
- static_cast<GLXContext*>(parent_context));
+ static_cast<GLXContext*>(parent_context));
}
GLXContext::GLXContext(GraphicsProvider* provider, Window* target_window)
@@ -74,8 +70,6 @@ GLXContext::~GLXContext() {
}
}
-
-
bool GLXContext::Initialize(GLContext* share_context) {
GtkWidget* window = GTK_WIDGET(target_window_->native_handle());
GtkWidget* draw_area = gtk_drawing_area_new();
@@ -90,8 +84,8 @@ bool GLXContext::Initialize(GLContext* share_context) {
Display* display = gdk_x11_display_get_xdisplay(gdk_display);
disp_ = display;
::Window root = gdk_x11_get_default_root_xwindow();
- static int vis_attrib_list[] =
- {GLX_RGBA, GLX_DEPTH_SIZE, 24, GLX_DOUBLEBUFFER, None};
+ static int vis_attrib_list[] = {GLX_RGBA, GLX_DEPTH_SIZE, 24,
+ GLX_DOUBLEBUFFER, None};
XVisualInfo* vi = glXChooseVisual(display, 0, vis_attrib_list);
if (vi == NULL) {
FatalGLError("No matching visuals for X display");
@@ -151,8 +145,8 @@ bool GLXContext::Initialize(GLContext* share_context) {
GLXContext* share_context_glx = static_cast<GLXContext*>(share_context);
glx_context_ = glXCreateContextAttribsARB(
display, nullptr,
- share_context ? share_context_glx->glx_context_ : nullptr, True,
- attrib_list);
+ share_context ? share_context_glx->glx_context_ : nullptr, True,
+ attrib_list);
glXMakeCurrent(display, 0, nullptr);
glXDestroyContext(display, temp_context);
if (!glx_context_) {
@@ -222,7 +216,8 @@ std::unique_ptr<GLXContext> GLXContext::CreateOffscreen(
robust_access_supported ? GLX_LOSE_CONTEXT_ON_RESET_ARB : 0,
0};
new_glrc = glXCreateContextAttribsARB(parent_context->disp_, nullptr,
- parent_context->glx_context_, True, attrib_list);
+ parent_context->glx_context_, True,
+ attrib_list);
if (!new_glrc) {
FatalGLError("Could not create shared context.");
return nullptr;
@@ -271,13 +266,10 @@ std::unique_ptr<GLXContext> GLXContext::CreateOffscreen(
return new_context;
}
-
-
bool GLXContext::is_current() {
return tls_glew_context_ == glew_context_.get();
}
-
bool GLXContext::MakeCurrent() {
SCOPE_profile_cpu_f("gpu");
if (FLAGS_thread_safe_gl) {
@@ -308,7 +300,6 @@ void GLXContext::ClearCurrent() {
}
}
-
void GLXContext::BeginSwap() {
SCOPE_profile_cpu_i("gpu", "xe::ui::gl::GLXContext::BeginSwap");
float clear_color[] = {238 / 255.0f, 238 / 255.0f, 238 / 255.0f, 1.0f};
diff --git a/src/xenia/ui/gl/gl_context_x11.h b/src/xenia/ui/gl/gl_context_x11.h
index 789df284f..6eea7fdb7 100644
--- a/src/xenia/ui/gl/gl_context_x11.h
+++ b/src/xenia/ui/gl/gl_context_x11.h
@@ -14,16 +14,15 @@
#include <memory>
-#include "xenia/ui/gl/gl_context.h"
+#include "third_party/GL/glxew.h"
+#include "xenia/base/platform_linux.h"
#include "xenia/ui/gl/blitter.h"
#include "xenia/ui/gl/gl.h"
+#include "xenia/ui/gl/gl_context.h"
#include "xenia/ui/graphics_context.h"
-#include "third_party/GL/glxew.h"
-#include "xenia/base/platform_linux.h"
DECLARE_bool(thread_safe_gl);
-
namespace xe {
namespace ui {
namespace gl {
@@ -35,7 +34,6 @@ class GLXContext : public GLContext {
public:
~GLXContext() override;
-
bool is_current() override;
bool MakeCurrent() override;
@@ -44,13 +42,12 @@ class GLXContext : public GLContext {
void BeginSwap() override;
void EndSwap() override;
-
protected:
- static std::unique_ptr<GLXContext> CreateOffscreen(GraphicsProvider* provider,
- GLXContext* parent_context);
+ static std::unique_ptr<GLXContext> CreateOffscreen(
+ GraphicsProvider* provider, GLXContext* parent_context);
bool Initialize(GLContext* share_context) override;
- void* handle() override {return glx_context_;}
+ void* handle() override { return glx_context_; }
private:
friend class GLContext;
diff --git a/src/xenia/ui/loop_gtk.cc b/src/xenia/ui/loop_gtk.cc
index 217e8c518..8beb967e5 100644
--- a/src/xenia/ui/loop_gtk.cc
+++ b/src/xenia/ui/loop_gtk.cc
@@ -14,7 +14,6 @@
namespace xe {
namespace ui {
-
class PostedFn {
public:
explicit PostedFn(std::function<void()> fn) : fn_(std::move(fn)) {}
@@ -28,7 +27,7 @@ std::unique_ptr<Loop> Loop::Create() { return std::make_unique<GTKLoop>(); }
GTKLoop::GTKLoop() : thread_id_() {
gtk_init(nullptr, nullptr);
- xe::threading::Fence init_fence;
+ xe::threading::Fence init_fence;
thread_ = std::thread([&init_fence, this]() {
xe::threading::set_name("GTK Loop");
@@ -47,39 +46,31 @@ GTKLoop::~GTKLoop() {
thread_.join();
}
-void GTKLoop::ThreadMain() {
-
- gtk_main();
-
-}
+void GTKLoop::ThreadMain() { gtk_main(); }
bool GTKLoop::is_on_loop_thread() {
return thread_id_ == std::this_thread::get_id();
}
-
gboolean _posted_fn_thunk(gpointer posted_fn) {
- PostedFn* Fn = reinterpret_cast<PostedFn*>(posted_fn);
- Fn->Call();
- return G_SOURCE_REMOVE;
+ PostedFn* Fn = reinterpret_cast<PostedFn*>(posted_fn);
+ Fn->Call();
+ return G_SOURCE_REMOVE;
}
void GTKLoop::Post(std::function<void()> fn) {
assert_true(thread_id_ != std::thread::id());
gdk_threads_add_idle(_posted_fn_thunk,
- reinterpret_cast<gpointer>(new PostedFn(std::move(fn))));
+ reinterpret_cast<gpointer>(new PostedFn(std::move(fn))));
}
-
void GTKLoop::PostDelayed(std::function<void()> fn, uint64_t delay_millis) {
- gdk_threads_add_timeout(delay_millis, _posted_fn_thunk,
- reinterpret_cast<gpointer>(new PostedFn(std::move(fn))));
+ gdk_threads_add_timeout(
+ delay_millis, _posted_fn_thunk,
+ reinterpret_cast<gpointer>(new PostedFn(std::move(fn))));
}
-void GTKLoop::Quit() {
- assert_true(thread_id_ != std::thread::id());
-
-}
+void GTKLoop::Quit() { assert_true(thread_id_ != std::thread::id()); }
void GTKLoop::AwaitQuit() { quit_fence_.Wait(); }
diff --git a/src/xenia/ui/loop_gtk.h b/src/xenia/ui/loop_gtk.h
index 6071851eb..4e24d8915 100644
--- a/src/xenia/ui/loop_gtk.h
+++ b/src/xenia/ui/loop_gtk.h
@@ -35,15 +35,13 @@ class GTKLoop : public Loop {
void Quit() override;
void AwaitQuit() override;
- private:
+ private:
void ThreadMain();
std::thread::id thread_id_;
std::thread thread_;
xe::threading::Fence quit_fence_;
-
-
};
} // namespace ui
diff --git a/src/xenia/ui/menu_item.h b/src/xenia/ui/menu_item.h
index 59c0ce15d..0ad9db54b 100644
--- a/src/xenia/ui/menu_item.h
+++ b/src/xenia/ui/menu_item.h
@@ -12,8 +12,8 @@
#include <functional>
#include <memory>
-#include <vector>
#include <string>
+#include <vector>
#include "xenia/ui/ui_event.h"
diff --git a/src/xenia/ui/vulkan/vulkan_context.cc b/src/xenia/ui/vulkan/vulkan_context.cc
index cef115278..da3d323be 100644
--- a/src/xenia/ui/vulkan/vulkan_context.cc
+++ b/src/xenia/ui/vulkan/vulkan_context.cc
@@ -73,16 +73,15 @@ bool VulkanContext::Initialize() {
assert(GDK_IS_X11_DISPLAY(gdk_display));
xcb_connection_t* connection =
XGetXCBConnection(gdk_x11_display_get_xdisplay(gdk_display));
- xcb_window_t window = gdk_x11_window_get_xid(
- gtk_widget_get_window(window_handle));
+ xcb_window_t window =
+ gdk_x11_window_get_xid(gtk_widget_get_window(window_handle));
VkXcbSurfaceCreateInfoKHR create_info;
create_info.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR;
create_info.pNext = nullptr;
create_info.flags = 0;
- create_info.connection = static_cast<xcb_connection_t*>
- (target_window_->native_platform_handle());
- create_info.window =
- static_cast<xcb_window_t>(window);
+ create_info.connection = static_cast<xcb_connection_t*>(
+ target_window_->native_platform_handle());
+ create_info.window = static_cast<xcb_window_t>(window);
auto err = vkCreateXcbSurfaceKHR(*provider->instance(), &create_info,
nullptr, &surface);
CheckResult(err, "vkCreateXcbSurfaceKHR");
diff --git a/src/xenia/ui/vulkan/vulkan_instance.cc b/src/xenia/ui/vulkan/vulkan_instance.cc
index 6aaa8c41c..3c51dfa1a 100644
--- a/src/xenia/ui/vulkan/vulkan_instance.cc
+++ b/src/xenia/ui/vulkan/vulkan_instance.cc
@@ -397,18 +397,17 @@ bool VulkanInstance::QueryDevices(Window* any_target_window) {
assert(GDK_IS_X11_DISPLAY(gdk_display));
xcb_connection_t* connection =
XGetXCBConnection(gdk_x11_display_get_xdisplay(gdk_display));
- xcb_window_t window = gdk_x11_window_get_xid(
- gtk_widget_get_window(window_handle));
+ xcb_window_t window =
+ gdk_x11_window_get_xid(gtk_widget_get_window(window_handle));
VkXcbSurfaceCreateInfoKHR create_info;
create_info.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR;
create_info.pNext = nullptr;
create_info.flags = 0;
- create_info.connection = static_cast<xcb_connection_t*>
- (any_target_window->native_platform_handle());
- create_info.window =
- static_cast<xcb_window_t>(window);
- auto err = vkCreateXcbSurfaceKHR(handle, &create_info,
- nullptr, &any_surface);
+ create_info.connection = static_cast<xcb_connection_t*>(
+ any_target_window->native_platform_handle());
+ create_info.window = static_cast<xcb_window_t>(window);
+ auto err =
+ vkCreateXcbSurfaceKHR(handle, &create_info, nullptr, &any_surface);
CheckResult(err, "vkCreateXcbSurfaceKHR");
#else
#error Unsupported GDK Backend on Linux.
diff --git a/src/xenia/ui/window_gtk.cc b/src/xenia/ui/window_gtk.cc
index fcf0f4e30..2e94f6ddc 100644
--- a/src/xenia/ui/window_gtk.cc
+++ b/src/xenia/ui/window_gtk.cc
@@ -17,7 +17,6 @@
namespace xe {
namespace ui {
-
class FnWrapper {
public:
explicit FnWrapper(std::function<void()> fn) : fn_(std::move(fn)) {}
@@ -161,12 +160,12 @@ void GTKWindow::set_focus(bool value) {
if (value) {
gtk_window_activate_focus(GTK_WINDOW(window_));
} else {
- // TODO(dougvj) Check to see if we need to do somethign here to unset
+ // TODO(dougvj) Check to see if we need to do something here to unset
// the focus.
}
- } else {
- has_focus_ = value;
- }
+ } else {
+ has_focus_ = value;
+ }
}
void GTKWindow::Resize(int32_t width, int32_t height) {
@@ -219,8 +218,6 @@ void GTKWindow::OnMainMenuChange() {
}
}
-
-
bool GTKWindow::HandleWindowOwnerChange(GdkEventOwnerChange* event) {
if (event->type == GDK_OWNER_CHANGE) {
if (event->reason == GDK_OWNER_CHANGE_DESTROY) {
@@ -231,8 +228,8 @@ bool GTKWindow::HandleWindowOwnerChange(GdkEventOwnerChange* event) {
OnClose();
}
return true;
- }
- return false;
+ }
+ return false;
}
bool GTKWindow::HandleWindowResize(GdkEventConfigure* event) {
@@ -244,8 +241,6 @@ bool GTKWindow::HandleWindowResize(GdkEventConfigure* event) {
return false;
}
-
-
bool GTKWindow::HandleWindowVisibility(GdkEventVisibility* event) {
// TODO(dougvj) The gdk docs say that this is deprecated because modern window
// managers composite everything and nothing is truly hidden.
@@ -258,8 +253,8 @@ bool GTKWindow::HandleWindowVisibility(GdkEventVisibility* event) {
OnHidden(&e);
}
return true;
- }
- return false;
+ }
+ return false;
}
bool GTKWindow::HandleWindowFocus(GdkEventFocus* event) {
@@ -274,8 +269,8 @@ bool GTKWindow::HandleWindowFocus(GdkEventFocus* event) {
OnGotFocus(&e);
}
return true;
- }
- return false;
+ }
+ return false;
}
bool GTKWindow::HandleMouse(GdkEventAny* event) {
@@ -326,26 +321,26 @@ bool GTKWindow::HandleMouse(GdkEventAny* event) {
dy = e->delta_y;
break;
}
- }
+ }
- auto e = MouseEvent(this, button, x, y, dx, dy);
- switch (event->type) {
- case GDK_BUTTON_PRESS:
- OnMouseDown(&e);
- break;
- case GDK_BUTTON_RELEASE:
- OnMouseUp(&e);
- break;
- case GDK_MOTION_NOTIFY:
- OnMouseMove(&e);
- break;
- case GDK_SCROLL:
- OnMouseWheel(&e);
- break;
- default:
- return false;
- }
- return e.is_handled();
+ auto e = MouseEvent(this, button, x, y, dx, dy);
+ switch (event->type) {
+ case GDK_BUTTON_PRESS:
+ OnMouseDown(&e);
+ break;
+ case GDK_BUTTON_RELEASE:
+ OnMouseUp(&e);
+ break;
+ case GDK_MOTION_NOTIFY:
+ OnMouseMove(&e);
+ break;
+ case GDK_SCROLL:
+ OnMouseWheel(&e);
+ break;
+ default:
+ return false;
+ }
+ return e.is_handled();
}
bool GTKWindow::HandleKeyboard(GdkEventKey* event) {
@@ -364,8 +359,8 @@ bool GTKWindow::HandleKeyboard(GdkEventKey* event) {
case GDK_KEY_RELEASE:
OnKeyUp(&e);
break;
-// TODO(dougvj) GDK doesn't have a KEY CHAR event, so we will have to
-// figure out its equivalent here to call OnKeyChar(&e);
+ // TODO(dougvj) GDK doesn't have a KEY CHAR event, so we will have to
+ // figure out its equivalent here to call OnKeyChar(&e);
default:
return false;
}
diff --git a/src/xenia/ui/window_gtk.h b/src/xenia/ui/window_gtk.h
index f6e18753f..b19248e18 100644
--- a/src/xenia/ui/window_gtk.h
+++ b/src/xenia/ui/window_gtk.h
@@ -13,9 +13,9 @@
#include <memory>
#include <string>
+#include "xenia/base/platform_linux.h"
#include "xenia/ui/menu_item.h"
#include "xenia/ui/window.h"
-#include "xenia/base/platform_linux.h"
namespace xe {
namespace ui {
@@ -27,9 +27,10 @@ class GTKWindow : public Window {
GTKWindow(Loop* loop, const std::wstring& title);
~GTKWindow() override;
- NativePlatformHandle native_platform_handle() const override {return nullptr;}
- NativeWindowHandle native_handle() const override { return window_;}
-
+ NativePlatformHandle native_platform_handle() const override {
+ return nullptr;
+ }
+ NativeWindowHandle native_handle() const override { return window_; }
bool set_title(const std::wstring& title) override;
@@ -60,7 +61,6 @@ class GTKWindow : public Window {
void OnResize(UIEvent* e) override;
-
private:
void Create();
GtkWidget* window_;
@@ -75,16 +75,15 @@ class GTKWindow : public Window {
bool closing_ = false;
bool fullscreen_ = false;
-
};
class GTKMenuItem : public MenuItem {
public:
GTKMenuItem(Type type, const std::wstring& text, const std::wstring& hotkey,
- std::function<void()> callback);
+ std::function<void()> callback);
~GTKMenuItem() override;
- GtkWidget* handle() {return menu_;}
+ GtkWidget* handle() { return menu_; }
using MenuItem::OnSelected;
protected: