Commit 4076d2f0 authored by dnicoara@chromium.org's avatar dnicoara@chromium.org

Adding Wayland message loop and gyp build deps

This CL depends on http://codereview.chromium.org/7457023

BUG=
TEST=


Review URL: http://codereview.chromium.org/7473010

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96428 0039d316-1c4b-4281-b951-d872f2087c98
parent f9cdd2a4
...@@ -368,6 +368,12 @@ ...@@ -368,6 +368,12 @@
'$(SDKROOT)/System/Library/Frameworks/ApplicationServices.framework/Frameworks', '$(SDKROOT)/System/Library/Frameworks/ApplicationServices.framework/Frameworks',
], ],
'conditions': [ 'conditions': [
[ 'use_wayland == 1', {
'sources!': [
'message_pump_gtk.cc',
'message_pump_x.cc',
],
}],
[ 'toolkit_uses_gtk==0', { [ 'toolkit_uses_gtk==0', {
'sources/': [ 'sources/': [
['exclude', '^nix/'], ['exclude', '^nix/'],
...@@ -581,6 +587,8 @@ ...@@ -581,6 +587,8 @@
'message_pump_libevent.h', 'message_pump_libevent.h',
'message_pump_mac.h', 'message_pump_mac.h',
'message_pump_mac.mm', 'message_pump_mac.mm',
'message_pump_wayland.cc',
'message_pump_wayland.h',
'metrics/field_trial.cc', 'metrics/field_trial.cc',
'metrics/field_trial.h', 'metrics/field_trial.h',
'string16.cc', 'string16.cc',
......
...@@ -31,11 +31,6 @@ ...@@ -31,11 +31,6 @@
#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
#include <gdk/gdk.h> #include <gdk/gdk.h>
#include <gdk/gdkx.h> #include <gdk/gdkx.h>
#if defined(TOUCH_UI)
#include "base/message_pump_x.h"
#else
#include "base/message_pump_gtk.h"
#endif // defined(TOUCH_UI)
#endif // defined(OS_POSIX) && !defined(OS_MACOSX) #endif // defined(OS_POSIX) && !defined(OS_MACOSX)
using base::TimeDelta; using base::TimeDelta;
...@@ -150,6 +145,9 @@ MessageLoop::MessageLoop(Type type) ...@@ -150,6 +145,9 @@ MessageLoop::MessageLoop(Type type)
#elif defined(OS_ANDROID) #elif defined(OS_ANDROID)
#define MESSAGE_PUMP_UI new base::MessagePumpForUI() #define MESSAGE_PUMP_UI new base::MessagePumpForUI()
#define MESSAGE_PUMP_IO new base::MessagePumpLibevent() #define MESSAGE_PUMP_IO new base::MessagePumpLibevent()
#elif defined(USE_WAYLAND)
#define MESSAGE_PUMP_UI new base::MessagePumpWayland()
#define MESSAGE_PUMP_IO new base::MessagePumpLibevent()
#elif defined(TOUCH_UI) #elif defined(TOUCH_UI)
#define MESSAGE_PUMP_UI new base::MessagePumpX() #define MESSAGE_PUMP_UI new base::MessagePumpX()
#define MESSAGE_PUMP_IO new base::MessagePumpLibevent() #define MESSAGE_PUMP_IO new base::MessagePumpLibevent()
......
...@@ -27,11 +27,15 @@ ...@@ -27,11 +27,15 @@
#elif defined(OS_POSIX) #elif defined(OS_POSIX)
#include "base/message_pump_libevent.h" #include "base/message_pump_libevent.h"
#if !defined(OS_MACOSX) #if !defined(OS_MACOSX)
#if defined(TOUCH_UI)
#if defined(USE_WAYLAND)
#include "base/message_pump_wayland.h"
#elif defined(TOUCH_UI)
#include "base/message_pump_x.h" #include "base/message_pump_x.h"
#else #else
#include "base/message_pump_gtk.h" #include "base/message_pump_gtk.h"
#endif #endif
#endif #endif
#endif #endif
......
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/message_pump_wayland.h"
#include <glib.h>
namespace base {
MessagePumpWayland::MessagePumpWayland()
: MessagePumpGlib(),
context_(g_main_context_default()) {
}
MessagePumpWayland::~MessagePumpWayland() {
}
bool MessagePumpWayland::RunOnce(GMainContext* context, bool block) {
// g_main_context_iteration returns true if events have been dispatched.
return g_main_context_iteration(context, block);
}
MessagePumpObserver::EventStatus
MessagePumpObserver::WillProcessEvent(ui::WaylandEvent* event) {
return EVENT_CONTINUE;
}
} // namespace base
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef BASE_MESSAGE_PUMP_WAYLAND_H_
#define BASE_MESSAGE_PUMP_WAYLAND_H_
#pragma once
#include "base/memory/scoped_ptr.h"
#include "base/message_pump_glib.h"
typedef struct _GMainContext GMainContext;
typedef struct _GPollFD GPollFD;
typedef struct _GSource GSource;
namespace ui {
union WaylandEvent;
} // namespace ui
namespace base {
// The documentation for this class is in message_pump_glib.h
class BASE_EXPORT MessagePumpObserver {
public:
enum EventStatus {
EVENT_CONTINUE, // The event should be dispatched as normal.
EVENT_HANDLED // The event should not be processed any farther.
};
// This method is called before processing an Event. If the method returns
// EVENT_HANDLED, it indicates the event has already been handled, so the
// event is not processed any farther. If the method returns EVENT_CONTINUE,
// the event dispatching proceeds as normal.
virtual EventStatus WillProcessEvent(ui::WaylandEvent* event);
protected:
virtual ~MessagePumpObserver() {}
};
// The documentation for this class is in message_pump_glib.h
//
// The nested loop is exited by either posting a quit, or returning false
// from Dispatch.
class MessagePumpDispatcher {
public:
enum DispatchStatus {
EVENT_IGNORED, // The event was not processed.
EVENT_PROCESSED, // The event has been processed.
EVENT_QUIT // The event was processed and the message-loop should
// terminate.
};
// Dispatches the event. If true is returned processing continues as
// normal. If false is returned, the nested loop exits immediately.
virtual DispatchStatus Dispatch(ui::WaylandEvent* event) = 0;
protected:
virtual ~MessagePumpDispatcher() {}
};
class BASE_EXPORT MessagePumpWayland : public MessagePumpGlib {
public:
MessagePumpWayland();
virtual ~MessagePumpWayland();
// Overridden from MessagePumpGlib
virtual bool RunOnce(GMainContext* context, bool block) OVERRIDE;
private:
// This is a GLib structure that we can add event sources to.
GMainContext* context_;
DISALLOW_COPY_AND_ASSIGN(MessagePumpWayland);
};
typedef MessagePumpWayland MessagePumpForUI;
} // namespace base
#endif // BASE_MESSAGE_PUMP_WAYLAND_H_
...@@ -93,6 +93,11 @@ ...@@ -93,6 +93,11 @@
}], }],
], ],
}], }],
['use_wayland == 1', {
'dependencies': [
'../ui/wayland/wayland.gyp:*',
],
}],
['toolkit_uses_gtk==1', { ['toolkit_uses_gtk==1', {
'dependencies': [ 'dependencies': [
'../tools/gtk_clipboard_dump/gtk_clipboard_dump.gyp:*', '../tools/gtk_clipboard_dump/gtk_clipboard_dump.gyp:*',
......
...@@ -90,8 +90,6 @@ ...@@ -90,8 +90,6 @@
'toolkit_views%': '<(toolkit_views)', 'toolkit_views%': '<(toolkit_views)',
'toolkit_uses_pure_views%': '<(toolkit_uses_pure_views)', 'toolkit_uses_pure_views%': '<(toolkit_uses_pure_views)',
'views_compositor%': '<(views_compositor)', 'views_compositor%': '<(views_compositor)',
# Whether to build for Wayland display server
'use_wayland%': 0,
# We used to provide a variable for changing how libraries were built. # We used to provide a variable for changing how libraries were built.
# This variable remains until we can clean up all the users. # This variable remains until we can clean up all the users.
...@@ -310,7 +308,8 @@ ...@@ -310,7 +308,8 @@
'clang_use_chrome_plugins%': '<(clang_use_chrome_plugins)', 'clang_use_chrome_plugins%': '<(clang_use_chrome_plugins)',
'enable_register_protocol_handler%': '<(enable_register_protocol_handler)', 'enable_register_protocol_handler%': '<(enable_register_protocol_handler)',
'enable_smooth_scrolling%': '<(enable_smooth_scrolling)', 'enable_smooth_scrolling%': '<(enable_smooth_scrolling)',
'use_wayland%': '<(use_wayland)', # Whether to build for Wayland display server
'use_wayland%': 0,
# The release channel that this build targets. This is used to restrict # The release channel that this build targets. This is used to restrict
# channel-specific build options, like which installer packages to create. # channel-specific build options, like which installer packages to create.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment