#include <cairo.h>
#include <sys/wait.h>
#include <sys/timerfd.h>
-#include <sys/epoll.h>
+#include <sys/epoll.h>
#include <linux/input.h>
#include <libgen.h>
#include <ctype.h>
static void
set_hex_color(cairo_t *cr, uint32_t color)
{
- cairo_set_source_rgba(cr,
+ cairo_set_source_rgba(cr,
((color >> 16) & 0xff) / 255.0,
((color >> 8) & 0xff) / 255.0,
((color >> 0) & 0xff) / 255.0,
static void
panel_launcher_touch_up_handler(struct widget *widget, struct input *input,
- uint32_t serial, uint32_t time, int32_t id,
+ uint32_t serial, uint32_t time, int32_t id,
void *data)
{
struct panel_launcher *launcher;
struct panel_launcher *launcher;
struct panel *panel = data;
int x, y, w, h;
-
+
x = 10;
y = 16;
wl_list_for_each(launcher, &panel->launcher_list, link) {
widget_set_redraw_handler(panel->widget, panel_redraw_handler);
widget_set_resize_handler(panel->widget, panel_resize_handler);
-
+
panel_add_clock(panel);
s = weston_config_get_section(desktop->config, "shell", NULL, NULL);
item = malloc(sizeof *item);
if (item == NULL)
return NULL;
-
-
+
+
gettimeofday(&tv, NULL);
item->seed = seed ? seed : tv.tv_usec;
srandom(item->seed);
-
+
const int petal_count = 3 + random() % 5;
const double r1 = 20 + random() % 10;
const double r2 = 5 + random() % 12;
data_source_send(void *data, struct wl_data_source *source,
const char *mime_type, int32_t fd)
{
- struct dnd_flower_message dnd_flower_message;
+ struct dnd_flower_message dnd_flower_message;
struct dnd_drag *dnd_drag = data;
char buffer[128];
int n;
* up the drag object created and the local state. */
wl_data_source_destroy(dnd_drag->data_source);
-
+
/* Destroy the item that has been dragged out */
cairo_surface_destroy(dnd_drag->item->surface);
free(dnd_drag->item);
len, sizeof *message);
return;
}
-
+
widget_get_allocation(dnd->widget, &allocation);
item = item_create(dnd->display,
x - message->x_offset - allocation.x,
if (!entry)
return;
-
+
if (entry->cursor != entry->anchor) {
int start_index = MIN(entry->cursor, entry->anchor);
int end_index = MAX(entry->cursor, entry->anchor);
cairo_curve_to(cr,
x1 - y1 * u, y1 + x1 * u,
x2 + y2 * v, y2 - x2 * v,
- x2, y2);
+ x2, y2);
cairo_curve_to(cr,
x2 - y2 * v, y2 + x2 * v,
}
static void
-touch_down_handler(struct widget *widget, struct input *input,
- uint32_t serial, uint32_t time, int32_t id,
+touch_down_handler(struct widget *widget, struct input *input,
+ uint32_t serial, uint32_t time, int32_t id,
float x, float y, void *data)
{
struct flower *flower = data;
}
static void
-touch_handler(struct widget *widget, struct input *input,
- uint32_t serial, uint32_t time, int32_t id,
+touch_handler(struct widget *widget, struct input *input,
+ uint32_t serial, uint32_t time, int32_t id,
float x, float y, void *data)
{
struct fullscreen *fullscreen = data;
static const struct gear_template gear_templates[] = {
{ { 0.8, 0.1, 0.0, 1.0 }, 1.0, 4.0, 1.0, 20, 0.7 },
{ { 0.0, 0.8, 0.2, 1.0 }, 0.5, 2.0, 2.0, 10, 0.7 },
- { { 0.2, 0.2, 1.0, 1.0 }, 1.3, 2.0, 0.5, 10, 0.7 },
+ { { 0.2, 0.2, 1.0, 1.0 }, 1.3, 2.0, 0.5, 10, 0.7 },
};
static GLfloat light_pos[4] = {5.0, 5.0, 10.0, 0.0};
die("Unable to acquire window surface, "
"compiled without cairo-egl?\n");
}
-
+
glViewport(allocation.x,
window_allocation.height - allocation.height - allocation.y,
allocation.width, allocation.height);
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation. No representations are made about the suitability of this
- * software for any purpose. It is provided "as is" without express or
+ * software for any purpose. It is provided "as is" without express or
* implied warranty.
*
* GLMatrix -- simulate the text scrolls from the movie "The Matrix".
Bool highlight[GRID_SIZE];
/* some glyphs may be highlighted */
-
+
int spin_speed; /* Rotate all spinners every this-many frames */
int spin_tick; /* frame counter */
s->highlight[i] = True;
}
- time_displayed_p = True;
+ time_displayed_p = True;
}
else
{
int i = ratio * WAVE_SIZE;
if (i < 0) i = 0;
- else if (i >= WAVE_SIZE) i = WAVE_SIZE-1;
+ else if (i >= WAVE_SIZE) i = WAVE_SIZE-1;
a *= mp->brightness_ramp[i];
}
}
-ENTRYPOINT void
+ENTRYPOINT void
init_matrix (ModeInfo *mi)
{
matrix_configuration *mp;
glScalef(0.5, 0.5, 0.5);
# endif
# if 0
- glRotatef(-30, 0, 1, 0);
+ glRotatef(-30, 0, 1, 0);
# endif
draw_grid (mi);
#endif
virtual_keyboard_commit_preedit(keyboard->keyboard);
wl_input_method_context_keysym(keyboard->keyboard->context,
display_get_serial(keyboard->keyboard->display),
- time,
+ time,
XKB_KEY_Return, key_state, mod_mask);
break;
case keytype_space:
virtual_keyboard_commit_preedit(keyboard->keyboard);
wl_input_method_context_keysym(keyboard->keyboard->context,
display_get_serial(keyboard->keyboard->display),
- time,
+ time,
XKB_KEY_Tab, key_state, mod_mask);
break;
case keytype_arrow_up:
virtual_keyboard_commit_preedit(keyboard->keyboard);
wl_input_method_context_keysym(keyboard->keyboard->context,
display_get_serial(keyboard->keyboard->display),
- time,
+ time,
XKB_KEY_Up, key_state, mod_mask);
break;
case keytype_arrow_left:
virtual_keyboard_commit_preedit(keyboard->keyboard);
wl_input_method_context_keysym(keyboard->keyboard->context,
display_get_serial(keyboard->keyboard->display),
- time,
+ time,
XKB_KEY_Left, key_state, mod_mask);
break;
case keytype_arrow_right:
virtual_keyboard_commit_preedit(keyboard->keyboard);
wl_input_method_context_keysym(keyboard->keyboard->context,
display_get_serial(keyboard->keyboard->display),
- time,
+ time,
XKB_KEY_Right, key_state, mod_mask);
break;
case keytype_arrow_down:
virtual_keyboard_commit_preedit(keyboard->keyboard);
wl_input_method_context_keysym(keyboard->keyboard->context,
display_get_serial(keyboard->keyboard->display),
- time,
+ time,
XKB_KEY_Down, key_state, mod_mask);
break;
case keytype_style:
uint32_t serial, uint32_t time, int32_t id,
float x, float y, void *data)
{
- touch_handler(input, time, x, y,
+ touch_handler(input, time, x, y,
WL_POINTER_BUTTON_STATE_PRESSED, data);
}
{
struct nested *nested = wl_resource_get_user_data(resource);
struct nested_surface *surface;
-
+
surface = zalloc(sizeof *surface);
if (surface == NULL) {
wl_resource_post_no_memory(resource);
machine->state = utf8state_reject;
break;
}
-
+
return machine->state;
}
apply_char_set(character_set cs, union utf8_char *utf8)
{
int i = 0;
-
+
while (cs[i].match.byte[0]) {
if ((*utf8).ch == cs[i].match.ch) {
*utf8 = cs[i].replace;
struct key_map map;
int len = 0;
int i = 0;
-
+
while (mode[i].sym) {
map = mode[i++];
if (sym == map.sym) {
break;
}
}
-
+
return len;
}
terminal_init_tabs(struct terminal *terminal)
{
int i = 0;
-
+
while (i < terminal->width) {
if (i % 8 == 0)
terminal->tab_ruler[i] = 1;
int i;
int window_height;
int from_row, to_row;
-
+
// scrolling range is inclusive
window_height = terminal->margin_bottom - terminal->margin_top + 1;
d = d % (window_height + 1);
d = 0 - d;
to_row = terminal->margin_bottom;
from_row = terminal->margin_bottom - d;
-
+
for (i = 0; i < (window_height - d); i++) {
memcpy(terminal_get_row(terminal, to_row - i),
terminal_get_row(terminal, from_row - i),
} else {
to_row = terminal->margin_top;
from_row = terminal->margin_top + d;
-
+
for (i = 0; i < (window_height - d); i++) {
memcpy(terminal_get_row(terminal, to_row + i),
terminal_get_row(terminal, from_row + i),
{
union utf8_char *row;
struct attr *attr_row;
-
+
row = terminal_get_row(terminal, terminal->row);
attr_row = terminal_get_attr_row(terminal, terminal->row);
d = terminal->column + 1 - terminal->width;
if ((terminal->column + d) >= terminal->width)
d = terminal->width - terminal->column - 1;
-
+
if (d < 0) {
d = 0 - d;
memmove(&row[terminal->column],
terminal_resize(terminal, 132, 24);
else
terminal_resize(terminal, 80, 24);
-
+
/* set columns, but also home cursor and clear screen */
terminal->row = 0; terminal->column = 0;
for (i = 0; i < terminal->height; i++) {
set[i] = 1;
}
}
-
+
switch (*p) {
case '@': /* ICH */
count = set[0] ? args[0] : 1;
case 'G': /* CHA */
y = set[0] ? args[0] : 1;
y = y <= 0 ? 1 : y > terminal->width ? terminal->width : y;
-
+
terminal->column = y - 1;
break;
case 'f': /* HVP */
x = (set[1] ? args[1] : 1) - 1;
x = x < 0 ? 0 :
(x >= terminal->width ? terminal->width - 1 : x);
-
+
y = (set[0] ? args[0] : 1) - 1;
if (terminal->origin_mode) {
y += terminal->margin_top;
y = y < 0 ? 0 :
(y >= terminal->height ? terminal->height - 1 : y);
}
-
+
terminal->row = y;
terminal->column = x;
break;
case '`': /* HPA */
y = set[0] ? args[0] : 1;
y = y <= 0 ? 1 : y > terminal->width ? terminal->width : y;
-
+
terminal->column = y - 1;
break;
case 'b': /* REP */
case 'd': /* VPA */
x = set[0] ? args[0] : 1;
x = x <= 0 ? 1 : x > terminal->height ? terminal->height : x;
-
+
terminal->row = x - 1;
break;
case 'g': /* TBC */
default:
fprintf(stderr, "Unknown CSI escape: %c\n", *p);
break;
- }
+ }
}
static void
default:
return 0;
}
-
+
return 1;
}
{
union utf8_char *row;
struct attr *attr_row;
-
+
if (handle_special_char(terminal, utf8.byte[0])) return;
apply_char_set(terminal->cs, &utf8);
-
+
/* There are a whole lot of non-characters, control codes,
* and formatting codes that should probably be ignored,
* for example: */
if (strncmp((char*) utf8.byte, "\xEF\xBB\xBF", 3) == 0) {
/* BOM, ignore */
return;
- }
-
+ }
+
/* Some of these non-characters should be translated, e.g.: */
if (utf8.byte[0] < 32) {
utf8.byte[0] = utf8.byte[0] + 64;
}
-
+
/* handle right margin effects */
if (terminal->column >= terminal->width) {
if (terminal->mode & MODE_AUTOWRAP) {
terminal->column--;
}
}
-
+
row = terminal_get_row(terminal, terminal->row);
attr_row = terminal_get_attr_row(terminal, terminal->row);
-
+
if (terminal->mode & MODE_IRM)
terminal_shift_line(terminal, +1);
row[terminal->column] = utf8;
if (terminal->escape_length >= MAX_ESCAPE)
terminal->state = escape_state_normal;
}
-
+
if (isalpha(utf8.byte[0]) || utf8.byte[0] == '@' ||
utf8.byte[0] == '`')
{
/* Handle special keys with alternate mappings */
len = apply_key_map(terminal->key_mode, sym, modifiers, ch);
if (len != 0) break;
-
+
if (modifiers & MOD_CONTROL_MASK) {
if (sym >= '3' && sym <= '7')
sym = (sym & 0x1f) + 8;
}
static void
-touch_handler(struct widget *widget, struct input *input,
- uint32_t serial, uint32_t time, int32_t id,
+touch_handler(struct widget *widget, struct input *input,
+ uint32_t serial, uint32_t time, int32_t id,
float x, float y, void *data)
{
struct transformed *transformed = data;
wl_list_for_each_safe(tp, tmp, &input->touch_point_list, link) {
if (tp->widget->touch_frame_handler)
- (*tp->widget->touch_frame_handler)(tp->widget, input,
+ (*tp->widget->touch_frame_handler)(tp->widget, input,
tp->widget->user_data);
}
}
continue;
if (seat->pointer->focus->surface->resource == NULL)
continue;
-
+
shsurf = get_shell_surface(seat->pointer->focus->surface);
if (shsurf &&
wl_resource_get_client(shsurf->resource) == sc->client)
&length, &ivisurfs);
for (i = 0; i < length; i++) {
if (ivisurf == ivisurfs[i]) {
- /*
+ /*
* if it is non new invoked application, just call
* commit_changes to apply source_rectangle.
*/