mirror of
https://github.com/cage-kiosk/cage.git
synced 2025-10-31 22:25:27 -04:00
util: remove unneeded module
This commit is contained in:
parent
d708a73aca
commit
ee5410d3fb
4 changed files with 0 additions and 50 deletions
|
|
@ -123,7 +123,6 @@ cage_sources = [
|
||||||
'idle_inhibit_v1.c',
|
'idle_inhibit_v1.c',
|
||||||
'output.c',
|
'output.c',
|
||||||
'seat.c',
|
'seat.c',
|
||||||
'util.c',
|
|
||||||
'view.c',
|
'view.c',
|
||||||
'xdg_shell.c',
|
'xdg_shell.c',
|
||||||
]
|
]
|
||||||
|
|
@ -136,7 +135,6 @@ cage_headers = [
|
||||||
'output.h',
|
'output.h',
|
||||||
'seat.h',
|
'seat.h',
|
||||||
'server.h',
|
'server.h',
|
||||||
'util.h',
|
|
||||||
'view.h',
|
'view.h',
|
||||||
'xdg_shell.h',
|
'xdg_shell.h',
|
||||||
]
|
]
|
||||||
|
|
|
||||||
1
output.c
1
output.c
|
|
@ -36,7 +36,6 @@
|
||||||
#include "output.h"
|
#include "output.h"
|
||||||
#include "seat.h"
|
#include "seat.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
#include "util.h"
|
|
||||||
#include "view.h"
|
#include "view.h"
|
||||||
#if CAGE_HAS_XWAYLAND
|
#if CAGE_HAS_XWAYLAND
|
||||||
#include "xwayland.h"
|
#include "xwayland.h"
|
||||||
|
|
|
||||||
36
util.c
36
util.c
|
|
@ -1,36 +0,0 @@
|
||||||
/*
|
|
||||||
* Cage: A Wayland kiosk.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2019 The Sway authors
|
|
||||||
*
|
|
||||||
* See the LICENSE file accompanying this file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
#include "util.h"
|
|
||||||
|
|
||||||
int
|
|
||||||
scale_length(int length, int offset, float scale)
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* One does not simply multiply the width by the scale. We allow fractional
|
|
||||||
* scaling, which means the resulting scaled width might be a decimal.
|
|
||||||
* So we round it.
|
|
||||||
*
|
|
||||||
* But even this can produce undesirable results depending on the X or Y
|
|
||||||
* offset of the box. For example, with a scale of 1.5, a box with
|
|
||||||
* width=1 should not scale to 2px if its X coordinate is 1, because the
|
|
||||||
* X coordinate would have scaled to 2px.
|
|
||||||
*/
|
|
||||||
return round((offset + length) * scale) - round(offset * scale);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
scale_box(struct wlr_box *box, float scale)
|
|
||||||
{
|
|
||||||
box->width = scale_length(box->width, box->x, scale);
|
|
||||||
box->height = scale_length(box->height, box->y, scale);
|
|
||||||
box->x = round(box->x * scale);
|
|
||||||
box->y = round(box->y * scale);
|
|
||||||
}
|
|
||||||
11
util.h
11
util.h
|
|
@ -1,11 +0,0 @@
|
||||||
#ifndef CG_UTIL_H
|
|
||||||
#define CG_UTIL_H
|
|
||||||
|
|
||||||
#include <wlr/util/box.h>
|
|
||||||
|
|
||||||
/** Apply scale to a width or height. */
|
|
||||||
int scale_length(int length, int offset, float scale);
|
|
||||||
|
|
||||||
void scale_box(struct wlr_box *box, float scale);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue