Skip to content

Commit

Permalink
Add wlr_fractional_scale_manager_v1
Browse files Browse the repository at this point in the history
  • Loading branch information
jwijenbergh committed Apr 7, 2024
1 parent fd53b23 commit 01201f8
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
21 changes: 21 additions & 0 deletions wlroots/ffi_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,26 @@ def has_xwayland() -> bool:
struct wlr_foreign_toplevel_handle_v1 *parent);
"""

# types/wlr_fractional_scale_v1.h
CDEF += """
struct wlr_fractional_scale_manager_v1 {
struct wl_global *global;
struct {
struct wl_signal destroy;
} events;
...;
};
void wlr_fractional_scale_v1_notify_scale(
struct wlr_surface *surface, double scale);
struct wlr_fractional_scale_manager_v1 *wlr_fractional_scale_manager_v1_create(
struct wl_display *display, uint32_t version);
"""

# types/wlr_gamma_control_v1.h
CDEF += """
struct wlr_gamma_control_manager_v1 {
Expand Down Expand Up @@ -2790,6 +2810,7 @@ def has_xwayland() -> bool:
#include <wlr/types/wlr_export_dmabuf_v1.h>
#include <wlr/types/wlr_viewporter.h>
#include <wlr/types/wlr_foreign_toplevel_management_v1.h>
#include <wlr/types/wlr_fractional_scale_v1.h>
#include <wlr/types/wlr_gamma_control_v1.h>
#include <wlr/types/wlr_idle_inhibit_v1.h>
#include <wlr/types/wlr_idle_notify_v1.h>
Expand Down
1 change: 1 addition & 0 deletions wlroots/wlr_types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from .data_device_manager import DataDeviceManager # noqa: F401
from .export_dmabuf_v1 import ExportDmabufManagerV1 # noqa: F401
from .foreign_toplevel_management_v1 import ForeignToplevelManagerV1 # noqa: F401
from .fractional_scale_v1 import FractionalScaleManagerV1 # noqa: F401
from .gamma_control_v1 import GammaControlManagerV1 # noqa: F401
from .input_device import InputDevice # noqa: F401
from .input_inhibit import InputInhibitManager # noqa: F401
Expand Down
17 changes: 17 additions & 0 deletions wlroots/wlr_types/fractional_scale_v1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright (c) 2024 Jeroen Wijenbergh

from pywayland.server import Display

from wlroots import PtrHasData, lib

from .compositor import Surface


class FractionalScaleManagerV1(PtrHasData):
def __init__(self, display: Display, version: int = 1) -> None:
"""Create a wlr_fractional_scale_manager_v1"""
self._ptr = lib.wlr_fractional_scale_manager_v1_create(display._ptr, version)


def notify_scale(surface: Surface, scale: float):
lib.wlr_fractional_scale_v1_notify_scale(surface._ptr, scale)

0 comments on commit 01201f8

Please sign in to comment.