August 18, 2016 - Mike Blumenkrantz

An Introduction to Enlightenment Gadget Orientation

This article is part of a series of tutorials about Enlightenment: a compositing and stacking window manager. This tutorial will discuss gadget orientations.

Orientation is a core concept that’s vital to understanding how a gadget will be displayed to the user, and it can improve the look of gadgets while also simplifying various parts of the code. In this context, orientation can be thought of as hints the gadget owner provides to the gadget that can be used to provide a more specific view of the gadget, based on it’s location.

There are two components to orientation within the gadget system: the orientation enum and the anchor enum. Here is the orientation enum:

This indicates the axis on which gadgets are positioned. In a horizontal taskbar-style layout E_GADGET_SITE_ORIENT_HORIZONTAL is used, whereas E_GADGET_SITE_ORIENT_VERTICAL would indicate a vertical layout similar to the bar style in Ubuntu’s Unity environment. E_GADGET_SITE_ORIENT_NONE is different; this value indicates there is no particular policy for gadget layout. In this case, gadgets should be considered freely positioned, such as on the desktop.

Here is the anchor enum:

This is a collection of bitflags that can be combined to indicate the relative position of a gadget. For example, combining E_GADGET_SITE_ANCHOR_LEFT and E_GADGET_SITE_ANCHOR_BOTTOM would indicate that the gadget is anchored to the bottom-left part of its owner, e.g. at the bottom-left of the screen. The E_GADGET_SITE_ANCHOR_NONE value again indicates there is no anchoring, meaning the gadget can be considered as “floating.”

Putting Orientation to Use

Now, let’s look at a concrete example of both of these concepts in use in the “Start” gadget:

This code breaks down the anchor flags to determine the gadget’s relative positioning, using the orientation to clarify positioning when the anchor information is insufficient. Based on this, the gadget is able to orient itself such that it faces away from the edge it’s positioned against. For example, when oriented horizontally along the bottom, it can display an upwards-pointing arrow, and when it is oriented vertically at the left it can show a rightward-pointing arrow.

Hopefully this tutorial has clarified orientation semantics for you. The next tutorial will cover sizing mechanics for gadgets, so stay tuned!

Mike Blumenkrantz

About Mike Blumenkrantz

Mike is the release manager for Enlightenment as well as a core developer of the EFL toolkit. He sometimes contributes to the Servo application embedding API/ABI, and in his free time he attempts to write desktop applications.

Image Credits: EFL Project

Development / EFL / Embedded Technology / Linux Compositing / enlightenment /


Leave a Reply to How Enlightenment Gadgets Handle Sizing - Samsung Open Source Group Blog Cancel reply

Your email address will not be published. Required fields are marked *

Comments Protected by WP-SpamShield Anti-Spam