Skip to content
This repository has been archived by the owner on Aug 20, 2020. It is now read-only.

Commit

Permalink
Shell: Implement xdg_shell.
Browse files Browse the repository at this point in the history
XDG-Shell will be detected at rumtime and used if present ;
adds feature : minimization.

Fixes #206 Fixes #223
  • Loading branch information
Manuel Bachmann authored and kalyankondapally committed Mar 21, 2014
1 parent 32dcf78 commit 5f8a34c
Show file tree
Hide file tree
Showing 14 changed files with 877 additions and 10 deletions.
3 changes: 2 additions & 1 deletion AUTHORS
Expand Up @@ -3,8 +3,9 @@ Dongseong Hwang <dongseong.hwang@intel.com>
Eduardo Lima (Etrunko) <eduardo.lima@intel.com>
Joone Hur <joone.hur@intel.com>
Kalyan Kondapally <kalyan.kondapally@intel.com>
Manuel Bachmann <manuel.bachmann@open.eurogiciel.org>
Michael Forney <mforney@mforney.org>
Michael Spang <spang@chromium.org>
Patrick Heeb <patrick.heeb@noser.com>
Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com>
Tiago Vignatti <tiago.vignatti@intel.com>
Patrick Heeb <patrick.heeb@noser.com>
3 changes: 2 additions & 1 deletion tools/check-coding-style.sh
Expand Up @@ -21,7 +21,8 @@ cd $SELF_DIR/..
FILTERS="+build,-build/header_guard,+whitespace,+readability,+legal,+runtime"

cpplint.py --filter="$FILTERS" $(find \
\( -name '*.h' -o -name '*.cc' \) | grep -v text-client-protocol.h )
\( -name '*.h' -o -name '*.cc' \) | grep -v text-client-protocol.h \
| grep -v xdg-shell-client-protocol.h)

# Return to previous dir and return the code returned by cpplint.py
RET_VAL=$?
Expand Down
9 changes: 9 additions & 0 deletions wayland/display.cc
Expand Up @@ -21,6 +21,7 @@ WaylandDisplay::WaylandDisplay(RegistrationType type) : display_(NULL),
registry_(NULL),
compositor_(NULL),
shell_(NULL),
xdg_shell_(NULL),
shm_(NULL),
primary_screen_(NULL),
primary_input_(NULL),
Expand Down Expand Up @@ -252,6 +253,9 @@ void WaylandDisplay::terminate() {
if (shell_)
wl_shell_destroy(shell_);

if (xdg_shell_)
xdg_shell_destroy(xdg_shell_);

if (shm_)
wl_shm_destroy(shm_);

Expand Down Expand Up @@ -302,6 +306,11 @@ void WaylandDisplay::DisplayHandleGlobal(void *data,
} else if (strcmp(interface, "wl_shell") == 0) {
disp->shell_ = static_cast<wl_shell*>(
wl_registry_bind(registry, name, &wl_shell_interface, 1));
} else if (strcmp(interface, "xdg_shell") == 0) {
disp->xdg_shell_ = static_cast<xdg_shell*>(
wl_registry_bind(registry, name, &xdg_shell_interface, 1));
xdg_shell_use_unstable_version(disp->xdg_shell_,
XDG_SHELL_VERSION_CURRENT);
} else if (strcmp(interface, "wl_shm") == 0) {
disp->shm_ = static_cast<wl_shm*>(
wl_registry_bind(registry, name, &wl_shm_interface, 1));
Expand Down
3 changes: 3 additions & 0 deletions wayland/display.h
Expand Up @@ -17,6 +17,7 @@
#include "base/basictypes.h"
#include "ozone/ui/events/window_state_change_handler.h"
#include "ozone/wayland/input/text-client-protocol.h"
#include "ozone/wayland/shell/xdg-shell-client-protocol.h"

namespace ozonewayland {

Expand Down Expand Up @@ -56,6 +57,7 @@ class WaylandDisplay : public ui::WindowStateChangeHandler {
WaylandScreen* PrimaryScreen() const { return primary_screen_ ; }

wl_shell* shell() const { return shell_; }
xdg_shell* xdgshell() const { return xdg_shell_; }

wl_shm* shm() const { return shm_; }
wl_compositor* GetCompositor() const { return compositor_; }
Expand Down Expand Up @@ -133,6 +135,7 @@ class WaylandDisplay : public ui::WindowStateChangeHandler {
wl_registry* registry_;
wl_compositor* compositor_;
wl_shell* shell_;
xdg_shell* xdg_shell_;
wl_shm* shm_;
struct wl_text_input_manager* text_input_manager_;
WaylandScreen* primary_screen_;
Expand Down
7 changes: 5 additions & 2 deletions wayland/shell/wl_shell_surface.cc
Expand Up @@ -25,7 +25,7 @@ WLShellSurface::~WLShellSurface() {
void WLShellSurface::UpdateShellSurface(WaylandWindow::ShellType type,
WaylandShellSurface* shell_parent,
unsigned x,
unsigned y) const {
unsigned y) {
switch (type) {
case WaylandWindow::TOPLEVEL:
wl_shell_surface_set_toplevel(shell_surface_);
Expand Down Expand Up @@ -64,11 +64,14 @@ void WLShellSurface::SetWindowTitle(const base::string16& title) {
WaylandShellSurface::FlushDisplay();
}

void WLShellSurface::Maximize() const {
void WLShellSurface::Maximize() {
wl_shell_surface_set_maximized(shell_surface_, NULL);
WaylandShellSurface::FlushDisplay();
}

void WLShellSurface::Minimize() {
}

void WLShellSurface::HandleConfigure(void* data,
struct wl_shell_surface* surface,
uint32_t edges,
Expand Down
5 changes: 3 additions & 2 deletions wayland/shell/wl_shell_surface.h
Expand Up @@ -20,9 +20,10 @@ class WLShellSurface : public WaylandShellSurface {
virtual void UpdateShellSurface(WaylandWindow::ShellType type,
WaylandShellSurface* shell_parent,
unsigned x,
unsigned y) const OVERRIDE;
unsigned y) OVERRIDE;
virtual void SetWindowTitle(const base::string16& title) OVERRIDE;
virtual void Maximize() const OVERRIDE;
virtual void Maximize() OVERRIDE;
virtual void Minimize() OVERRIDE;

static void HandleConfigure(void* data,
struct wl_shell_surface* shell_surface,
Expand Down

0 comments on commit 5f8a34c

Please sign in to comment.