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

Unified Diff: gpu/demos/framework/window_linux.cc

Issue 565041: Implemented window class on linux. Standalone demos are working on linux now. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 11 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
« no previous file with comments | « gpu/demos/framework/main_exe.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/demos/framework/window_linux.cc
===================================================================
--- gpu/demos/framework/window_linux.cc (revision 37981)
+++ gpu/demos/framework/window_linux.cc (working copy)
@@ -4,19 +4,60 @@
#include "gpu/demos/framework/window.h"
+#include <gdk/gdkx.h>
+#include <gtk/gtk.h>
+
+#include "base/utf_string_conversions.h"
+
+namespace {
+using gpu::demos::Window;
+
+gboolean OnDelete(GtkWidget* widget, GdkEventExpose* event) {
+ gtk_main_quit();
+ return FALSE;
+}
+
+gboolean OnExpose(GtkWidget* widget, GdkEventExpose* event, gpointer data) {
+ Window* window = static_cast<Window*>(data);
+ window->OnPaint();
+
+ // TODO(alokp): Figure out why this is crashing. Animation will not work
+ // until then.
+ //gtk_widget_queue_draw(widget);
+ return FALSE;
+}
+} // namespace
+
namespace gpu {
namespace demos {
void Window::MainLoop() {
+ gtk_signal_connect(GTK_OBJECT(window_handle_),
+ "delete_event",
+ reinterpret_cast<GtkSignalFunc>(OnDelete),
+ NULL);
+ gtk_signal_connect(GTK_OBJECT(window_handle_),
+ "expose_event",
+ reinterpret_cast<GtkSignalFunc>(OnExpose),
+ this);
+ gtk_main();
}
gfx::NativeWindow Window::CreateNativeWindow(const wchar_t* title,
int width, int height) {
- return NULL;
+ GtkWidget* hwnd = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+
+ gtk_window_set_title(GTK_WINDOW(hwnd), WideToUTF8(title).c_str());
+ gtk_window_set_default_size(GTK_WINDOW(hwnd), width, height);
+ gtk_widget_set_double_buffered(hwnd, FALSE);
+ gtk_widget_set_app_paintable(hwnd, TRUE);
+
+ gtk_widget_show(hwnd);
+ return GTK_WINDOW(hwnd);
}
gfx::PluginWindowHandle Window::PluginWindow(gfx::NativeWindow hwnd) {
- return gfx::kNullPluginWindow;
+ return GDK_WINDOW_XWINDOW(GTK_WIDGET(hwnd)->window);
}
} // namespace demos
« no previous file with comments | « gpu/demos/framework/main_exe.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698