2010-12-16 18:35:23 +00:00
|
|
|
/*
|
|
|
|
* Copyright © 2010 Intel Corporation
|
|
|
|
*
|
2015-06-11 05:48:59 +00:00
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
2010-12-16 18:35:23 +00:00
|
|
|
*
|
2015-06-11 05:48:59 +00:00
|
|
|
* The above copyright notice and this permission notice (including the next
|
|
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
|
|
* Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
* DEALINGS IN THE SOFTWARE.
|
2010-12-16 18:35:23 +00:00
|
|
|
*/
|
|
|
|
|
2014-04-07 11:40:35 +00:00
|
|
|
#include "config.h"
|
|
|
|
|
2014-11-26 09:40:42 +00:00
|
|
|
#include <stdbool.h>
|
2010-12-16 18:35:23 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <cairo.h>
|
2010-12-16 19:56:41 +00:00
|
|
|
#include <math.h>
|
2011-12-15 13:26:29 +00:00
|
|
|
#include <assert.h>
|
2010-12-16 18:35:23 +00:00
|
|
|
|
2011-12-19 20:36:10 +00:00
|
|
|
#include <linux/input.h>
|
2011-11-22 12:18:50 +00:00
|
|
|
#include <wayland-client.h>
|
2010-12-16 18:35:23 +00:00
|
|
|
|
|
|
|
#include "window.h"
|
2016-03-16 21:15:18 +00:00
|
|
|
#include "shared/xalloc.h"
|
2010-12-16 18:35:23 +00:00
|
|
|
|
2012-05-11 03:10:54 +00:00
|
|
|
struct spring {
|
|
|
|
double current;
|
|
|
|
double target;
|
|
|
|
double previous;
|
|
|
|
};
|
|
|
|
|
2010-12-16 18:35:23 +00:00
|
|
|
struct resizor {
|
|
|
|
struct display *display;
|
|
|
|
struct window *window;
|
2012-01-10 14:43:58 +00:00
|
|
|
struct widget *widget;
|
2011-01-21 23:03:15 +00:00
|
|
|
struct window *menu;
|
2012-05-11 03:10:54 +00:00
|
|
|
struct spring width;
|
|
|
|
struct spring height;
|
2011-12-15 13:26:29 +00:00
|
|
|
struct wl_callback *frame_callback;
|
2014-11-26 09:40:42 +00:00
|
|
|
bool pointer_locked;
|
|
|
|
struct input *locked_input;
|
|
|
|
float pointer_x;
|
|
|
|
float pointer_y;
|
2010-12-16 18:35:23 +00:00
|
|
|
};
|
|
|
|
|
2010-12-17 02:11:10 +00:00
|
|
|
static void
|
2012-05-11 03:10:54 +00:00
|
|
|
spring_update(struct spring *spring)
|
2010-12-17 02:11:10 +00:00
|
|
|
{
|
2012-05-11 03:10:54 +00:00
|
|
|
double current, force;
|
2010-12-17 02:11:10 +00:00
|
|
|
|
2012-05-11 03:10:54 +00:00
|
|
|
current = spring->current;
|
|
|
|
force = (spring->target - current) / 20.0 +
|
|
|
|
(spring->previous - current);
|
2011-12-15 13:26:29 +00:00
|
|
|
|
2012-05-11 03:10:54 +00:00
|
|
|
spring->current = current + (current - spring->previous) + force;
|
|
|
|
spring->previous = current;
|
|
|
|
}
|
2010-12-17 02:11:10 +00:00
|
|
|
|
2012-05-11 03:10:54 +00:00
|
|
|
static int
|
|
|
|
spring_done(struct spring *spring)
|
|
|
|
{
|
|
|
|
return fabs(spring->previous - spring->target) < 0.1;
|
|
|
|
}
|
2010-12-17 02:11:10 +00:00
|
|
|
|
2012-05-11 03:10:54 +00:00
|
|
|
static const struct wl_callback_listener listener;
|
2010-12-17 02:11:10 +00:00
|
|
|
|
2012-05-11 03:10:54 +00:00
|
|
|
static void
|
|
|
|
frame_callback(void *data, struct wl_callback *callback, uint32_t time)
|
|
|
|
{
|
|
|
|
struct resizor *resizor = data;
|
|
|
|
|
|
|
|
assert(!callback || callback == resizor->frame_callback);
|
|
|
|
|
2014-01-17 23:31:33 +00:00
|
|
|
if (resizor->frame_callback) {
|
|
|
|
wl_callback_destroy(resizor->frame_callback);
|
|
|
|
resizor->frame_callback = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (window_is_maximized(resizor->window))
|
|
|
|
return;
|
|
|
|
|
2012-05-11 03:10:54 +00:00
|
|
|
spring_update(&resizor->width);
|
|
|
|
spring_update(&resizor->height);
|
2010-12-17 02:11:10 +00:00
|
|
|
|
2012-05-11 03:10:54 +00:00
|
|
|
widget_schedule_resize(resizor->widget,
|
|
|
|
resizor->width.current + 0.5,
|
|
|
|
resizor->height.current + 0.5);
|
2011-08-23 22:14:06 +00:00
|
|
|
|
2012-05-11 03:10:54 +00:00
|
|
|
if (!spring_done(&resizor->width) || !spring_done(&resizor->height)) {
|
|
|
|
resizor->frame_callback =
|
|
|
|
wl_surface_frame(
|
|
|
|
window_get_wl_surface(resizor->window));
|
|
|
|
wl_callback_add_listener(resizor->frame_callback, &listener,
|
|
|
|
resizor);
|
|
|
|
}
|
2010-12-17 02:11:10 +00:00
|
|
|
}
|
|
|
|
|
2012-01-11 00:11:42 +00:00
|
|
|
static const struct wl_callback_listener listener = {
|
|
|
|
frame_callback
|
|
|
|
};
|
|
|
|
|
2010-12-16 18:35:23 +00:00
|
|
|
static void
|
2012-01-10 17:23:19 +00:00
|
|
|
redraw_handler(struct widget *widget, void *data)
|
2010-12-16 18:35:23 +00:00
|
|
|
{
|
2012-01-10 17:23:19 +00:00
|
|
|
struct resizor *resizor = data;
|
2010-12-16 18:35:23 +00:00
|
|
|
cairo_surface_t *surface;
|
|
|
|
cairo_t *cr;
|
2011-01-11 15:00:52 +00:00
|
|
|
struct rectangle allocation;
|
2010-12-16 18:35:23 +00:00
|
|
|
|
2012-01-11 00:11:42 +00:00
|
|
|
widget_get_allocation(resizor->widget, &allocation);
|
2010-12-16 18:35:23 +00:00
|
|
|
|
|
|
|
surface = window_get_surface(resizor->window);
|
|
|
|
|
|
|
|
cr = cairo_create(surface);
|
|
|
|
cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
|
|
|
|
cairo_rectangle(cr,
|
2011-01-11 15:00:52 +00:00
|
|
|
allocation.x,
|
|
|
|
allocation.y,
|
|
|
|
allocation.width,
|
|
|
|
allocation.height);
|
2010-12-16 18:35:23 +00:00
|
|
|
cairo_set_source_rgba(cr, 0, 0, 0, 0.8);
|
|
|
|
cairo_fill(cr);
|
|
|
|
cairo_destroy(cr);
|
|
|
|
|
|
|
|
cairo_surface_destroy(surface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
keyboard_focus_handler(struct window *window,
|
|
|
|
struct input *device, void *data)
|
|
|
|
{
|
|
|
|
struct resizor *resizor = data;
|
|
|
|
|
|
|
|
window_schedule_redraw(resizor->window);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2011-01-19 19:20:33 +00:00
|
|
|
key_handler(struct window *window, struct input *input, uint32_t time,
|
2012-05-30 15:31:52 +00:00
|
|
|
uint32_t key, uint32_t sym, enum wl_keyboard_key_state state,
|
|
|
|
void *data)
|
2010-12-16 18:35:23 +00:00
|
|
|
{
|
|
|
|
struct resizor *resizor = data;
|
2012-05-11 03:10:54 +00:00
|
|
|
struct rectangle allocation;
|
2010-12-16 18:35:23 +00:00
|
|
|
|
2012-05-30 15:31:52 +00:00
|
|
|
if (state == WL_KEYBOARD_KEY_STATE_RELEASED)
|
2010-12-16 18:35:23 +00:00
|
|
|
return;
|
|
|
|
|
2012-05-11 03:10:54 +00:00
|
|
|
window_get_allocation(resizor->window, &allocation);
|
|
|
|
resizor->width.current = allocation.width;
|
|
|
|
if (spring_done(&resizor->width))
|
|
|
|
resizor->width.target = allocation.width;
|
|
|
|
resizor->height.current = allocation.height;
|
|
|
|
if (spring_done(&resizor->height))
|
|
|
|
resizor->height.target = allocation.height;
|
|
|
|
|
2010-12-16 18:35:23 +00:00
|
|
|
switch (sym) {
|
2012-05-11 15:24:29 +00:00
|
|
|
case XKB_KEY_Up:
|
2012-05-11 03:10:54 +00:00
|
|
|
if (allocation.height < 400)
|
|
|
|
break;
|
|
|
|
|
|
|
|
resizor->height.target = allocation.height - 200;
|
|
|
|
break;
|
|
|
|
|
2012-05-11 15:24:29 +00:00
|
|
|
case XKB_KEY_Down:
|
2012-05-11 03:10:54 +00:00
|
|
|
if (allocation.height > 1000)
|
|
|
|
break;
|
|
|
|
|
|
|
|
resizor->height.target = allocation.height + 200;
|
2010-12-16 18:35:23 +00:00
|
|
|
break;
|
2012-05-11 03:10:54 +00:00
|
|
|
|
2012-05-11 15:24:29 +00:00
|
|
|
case XKB_KEY_Left:
|
2012-05-11 03:10:54 +00:00
|
|
|
if (allocation.width < 400)
|
|
|
|
break;
|
|
|
|
|
|
|
|
resizor->width.target = allocation.width - 200;
|
|
|
|
break;
|
|
|
|
|
2012-05-11 15:24:29 +00:00
|
|
|
case XKB_KEY_Right:
|
2012-05-11 03:10:54 +00:00
|
|
|
if (allocation.width > 1000)
|
|
|
|
break;
|
|
|
|
|
|
|
|
resizor->width.target = allocation.width + 200;
|
2010-12-16 18:35:23 +00:00
|
|
|
break;
|
2012-05-11 03:10:54 +00:00
|
|
|
|
2012-05-11 15:24:29 +00:00
|
|
|
case XKB_KEY_Escape:
|
2011-12-15 13:26:29 +00:00
|
|
|
display_exit(resizor->display);
|
|
|
|
break;
|
2010-12-16 18:35:23 +00:00
|
|
|
}
|
2012-05-11 03:10:54 +00:00
|
|
|
|
|
|
|
if (!resizor->frame_callback)
|
|
|
|
frame_callback(resizor, NULL, 0);
|
2010-12-16 18:35:23 +00:00
|
|
|
}
|
|
|
|
|
2012-01-07 02:59:05 +00:00
|
|
|
static void
|
2014-03-13 16:06:00 +00:00
|
|
|
menu_func(void *data, struct input *input, int index)
|
2012-01-07 02:59:05 +00:00
|
|
|
{
|
|
|
|
fprintf(stderr, "picked entry %d\n", index);
|
|
|
|
}
|
|
|
|
|
2011-01-21 23:03:15 +00:00
|
|
|
static void
|
2012-01-05 03:19:14 +00:00
|
|
|
show_menu(struct resizor *resizor, struct input *input, uint32_t time)
|
2011-01-21 23:03:15 +00:00
|
|
|
{
|
2011-12-19 20:40:10 +00:00
|
|
|
int32_t x, y;
|
|
|
|
static const char *entries[] = {
|
|
|
|
"Roy", "Pris", "Leon", "Zhora"
|
|
|
|
};
|
2011-01-21 23:03:15 +00:00
|
|
|
|
|
|
|
input_get_position(input, &x, &y);
|
2012-01-19 13:17:59 +00:00
|
|
|
window_show_menu(resizor->display, input, time, resizor->window,
|
|
|
|
x - 10, y - 10, menu_func, entries, 4);
|
2011-01-21 23:03:15 +00:00
|
|
|
}
|
|
|
|
|
2014-11-26 09:40:42 +00:00
|
|
|
static void
|
|
|
|
locked_pointer_handle_motion(struct window *window,
|
|
|
|
struct input *input,
|
|
|
|
uint32_t time,
|
|
|
|
float dx,
|
|
|
|
float dy,
|
|
|
|
void *data)
|
|
|
|
{
|
|
|
|
struct resizor *resizor = data;
|
|
|
|
|
|
|
|
resizor->width.current += dx;
|
|
|
|
resizor->width.previous = resizor->width.current;
|
|
|
|
resizor->width.target = resizor->width.current;
|
|
|
|
|
|
|
|
resizor->height.current += dy;
|
|
|
|
resizor->height.previous = resizor->height.current;
|
|
|
|
resizor->height.target = resizor->height.current;
|
|
|
|
|
|
|
|
widget_schedule_resize(resizor->widget,
|
|
|
|
resizor->width.current,
|
|
|
|
resizor->height.current);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
handle_pointer_locked(struct window *window, struct input *input, void *data)
|
|
|
|
{
|
|
|
|
struct resizor *resizor = data;
|
|
|
|
|
|
|
|
resizor->pointer_locked = true;
|
|
|
|
input_set_pointer_image(input, CURSOR_BLANK);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
handle_pointer_unlocked(struct window *window, struct input *input, void *data)
|
|
|
|
{
|
|
|
|
struct resizor *resizor = data;
|
|
|
|
|
|
|
|
resizor->pointer_locked = false;
|
|
|
|
input_set_pointer_image(input, CURSOR_LEFT_PTR);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct wl_callback_listener locked_pointer_frame_listener;
|
|
|
|
|
|
|
|
static void
|
|
|
|
locked_pointer_frame_callback(void *data,
|
|
|
|
struct wl_callback *callback,
|
|
|
|
uint32_t time)
|
|
|
|
{
|
|
|
|
struct resizor *resizor = data;
|
|
|
|
struct wl_surface *surface;
|
|
|
|
struct rectangle allocation;
|
|
|
|
float x, y;
|
|
|
|
|
|
|
|
if (resizor->pointer_locked) {
|
|
|
|
widget_get_allocation(resizor->widget, &allocation);
|
|
|
|
|
|
|
|
x = resizor->pointer_x + (allocation.width - allocation.x);
|
|
|
|
y = resizor->pointer_y + (allocation.height - allocation.y);
|
|
|
|
|
|
|
|
widget_set_locked_pointer_cursor_hint(resizor->widget, x, y);
|
|
|
|
}
|
|
|
|
|
|
|
|
wl_callback_destroy(callback);
|
|
|
|
|
|
|
|
surface = window_get_wl_surface(resizor->window);
|
|
|
|
callback = wl_surface_frame(surface);
|
|
|
|
wl_callback_add_listener(callback,
|
|
|
|
&locked_pointer_frame_listener,
|
|
|
|
resizor);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct wl_callback_listener locked_pointer_frame_listener = {
|
|
|
|
locked_pointer_frame_callback
|
|
|
|
};
|
|
|
|
|
2011-01-21 23:03:15 +00:00
|
|
|
static void
|
2012-01-09 16:12:05 +00:00
|
|
|
button_handler(struct widget *widget,
|
2011-01-21 23:03:15 +00:00
|
|
|
struct input *input, uint32_t time,
|
2012-05-30 15:31:51 +00:00
|
|
|
uint32_t button, enum wl_pointer_button_state state, void *data)
|
2011-01-21 23:03:15 +00:00
|
|
|
{
|
2012-01-10 14:43:58 +00:00
|
|
|
struct resizor *resizor = data;
|
2014-11-26 09:40:42 +00:00
|
|
|
struct rectangle allocation;
|
|
|
|
struct wl_surface *surface;
|
|
|
|
struct wl_callback *callback;
|
2011-01-21 23:03:15 +00:00
|
|
|
|
2014-11-26 09:40:42 +00:00
|
|
|
if (button == BTN_RIGHT && state == WL_POINTER_BUTTON_STATE_PRESSED) {
|
|
|
|
show_menu(resizor, input, time);
|
|
|
|
} else if (button == BTN_LEFT &&
|
|
|
|
state == WL_POINTER_BUTTON_STATE_PRESSED) {
|
|
|
|
window_get_allocation(resizor->window, &allocation);
|
|
|
|
|
|
|
|
resizor->width.current = allocation.width;
|
|
|
|
resizor->width.previous = allocation.width;
|
|
|
|
resizor->width.target = allocation.width;
|
|
|
|
|
|
|
|
resizor->height.current = allocation.height;
|
|
|
|
resizor->height.previous = allocation.height;
|
|
|
|
resizor->height.target = allocation.height;
|
|
|
|
|
|
|
|
window_lock_pointer(resizor->window, input);
|
|
|
|
window_set_pointer_locked_handler(resizor->window,
|
|
|
|
handle_pointer_locked,
|
|
|
|
handle_pointer_unlocked);
|
|
|
|
resizor->locked_input = input;
|
|
|
|
|
|
|
|
surface = window_get_wl_surface(resizor->window);
|
|
|
|
callback = wl_surface_frame(surface);
|
|
|
|
wl_callback_add_listener(callback,
|
|
|
|
&locked_pointer_frame_listener,
|
|
|
|
resizor);
|
|
|
|
} else if (button == BTN_LEFT &&
|
|
|
|
state == WL_POINTER_BUTTON_STATE_RELEASED) {
|
|
|
|
input_set_pointer_image(input, CURSOR_LEFT_PTR);
|
|
|
|
window_unlock_pointer(resizor->window);
|
2011-01-21 23:03:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-26 09:40:42 +00:00
|
|
|
static void
|
|
|
|
set_cursor_inv_offset(struct resizor *resizor, float x, float y)
|
|
|
|
{
|
|
|
|
struct rectangle allocation;
|
|
|
|
|
|
|
|
widget_get_allocation(resizor->widget, &allocation);
|
|
|
|
|
|
|
|
resizor->pointer_x = x - (allocation.width - allocation.x);
|
|
|
|
resizor->pointer_y = y - (allocation.height - allocation.y);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
enter_handler(struct widget *widget,
|
|
|
|
struct input *input,
|
|
|
|
float x, float y, void *data)
|
|
|
|
{
|
|
|
|
struct resizor *resizor = data;
|
|
|
|
|
|
|
|
set_cursor_inv_offset(resizor, x , y);
|
|
|
|
|
|
|
|
return CURSOR_LEFT_PTR;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
motion_handler(struct widget *widget,
|
|
|
|
struct input *input, uint32_t time,
|
|
|
|
float x, float y, void *data)
|
|
|
|
{
|
|
|
|
struct resizor *resizor = data;
|
|
|
|
|
|
|
|
set_cursor_inv_offset(resizor, x , y);
|
|
|
|
|
|
|
|
return CURSOR_LEFT_PTR;
|
|
|
|
}
|
|
|
|
|
2010-12-16 18:35:23 +00:00
|
|
|
static struct resizor *
|
|
|
|
resizor_create(struct display *display)
|
|
|
|
{
|
|
|
|
struct resizor *resizor;
|
|
|
|
|
2013-08-08 01:57:05 +00:00
|
|
|
resizor = xzalloc(sizeof *resizor);
|
2012-01-31 20:24:48 +00:00
|
|
|
resizor->window = window_create(display);
|
2013-10-14 00:08:38 +00:00
|
|
|
resizor->widget = window_frame_create(resizor->window, resizor);
|
2011-01-21 23:03:15 +00:00
|
|
|
window_set_title(resizor->window, "Wayland Resizor");
|
2010-12-16 18:35:23 +00:00
|
|
|
resizor->display = display;
|
|
|
|
|
|
|
|
window_set_key_handler(resizor->window, key_handler);
|
|
|
|
window_set_user_data(resizor->window, resizor);
|
2012-01-10 17:23:19 +00:00
|
|
|
widget_set_redraw_handler(resizor->widget, redraw_handler);
|
2010-12-16 18:35:23 +00:00
|
|
|
window_set_keyboard_focus_handler(resizor->window,
|
|
|
|
keyboard_focus_handler);
|
|
|
|
|
2014-11-26 09:40:42 +00:00
|
|
|
widget_set_enter_handler(resizor->widget, enter_handler);
|
|
|
|
widget_set_motion_handler(resizor->widget, motion_handler);
|
|
|
|
|
|
|
|
window_set_locked_pointer_motion_handler(
|
|
|
|
resizor->window, locked_pointer_handle_motion);
|
|
|
|
|
2012-05-11 03:10:54 +00:00
|
|
|
widget_set_button_handler(resizor->widget, button_handler);
|
|
|
|
|
|
|
|
resizor->height.previous = 400;
|
2010-12-16 18:35:23 +00:00
|
|
|
resizor->height.current = 400;
|
2012-05-11 03:10:54 +00:00
|
|
|
resizor->height.target = 400;
|
2010-12-16 18:35:23 +00:00
|
|
|
|
2012-05-11 03:10:54 +00:00
|
|
|
resizor->width.previous = 400;
|
|
|
|
resizor->width.current = 400;
|
|
|
|
resizor->width.target = 400;
|
2010-12-16 18:35:23 +00:00
|
|
|
|
2012-05-11 03:10:54 +00:00
|
|
|
widget_schedule_resize(resizor->widget, 400, 400);
|
2010-12-16 18:35:23 +00:00
|
|
|
|
|
|
|
return resizor;
|
|
|
|
}
|
|
|
|
|
2011-12-15 13:26:29 +00:00
|
|
|
static void
|
|
|
|
resizor_destroy(struct resizor *resizor)
|
|
|
|
{
|
|
|
|
if (resizor->frame_callback)
|
|
|
|
wl_callback_destroy(resizor->frame_callback);
|
|
|
|
|
2012-01-19 12:21:35 +00:00
|
|
|
widget_destroy(resizor->widget);
|
2011-12-15 13:26:29 +00:00
|
|
|
window_destroy(resizor->window);
|
|
|
|
free(resizor);
|
|
|
|
}
|
|
|
|
|
2010-12-16 18:35:23 +00:00
|
|
|
int
|
|
|
|
main(int argc, char *argv[])
|
|
|
|
{
|
2011-12-15 13:26:29 +00:00
|
|
|
struct display *display;
|
|
|
|
struct resizor *resizor;
|
2010-12-16 18:35:23 +00:00
|
|
|
|
2013-02-20 20:27:49 +00:00
|
|
|
display = display_create(&argc, argv);
|
2011-12-15 13:26:29 +00:00
|
|
|
if (display == NULL) {
|
2010-12-16 18:35:23 +00:00
|
|
|
fprintf(stderr, "failed to create display: %m\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2011-12-15 13:26:29 +00:00
|
|
|
resizor = resizor_create(display);
|
|
|
|
|
|
|
|
display_run(display);
|
2010-12-16 18:35:23 +00:00
|
|
|
|
2011-12-15 13:26:29 +00:00
|
|
|
resizor_destroy(resizor);
|
|
|
|
display_destroy(display);
|
2010-12-16 18:35:23 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|