forked from 12to11/12to11
Check in changes to core files used for tests
* 12to11.c (XLMain): Initialize tests. * 12to11.conf (WAYLAND_CLIENT, PNG): New libraries (BuildTests): New define. * Imakefile: Add the ability to build tests in a subdirectory. * compositor.c (HandleResourceDestroy, HandleBind): Remove unused list. * compositor.h (enum _RoleType): Add TestSurfaceType. * run.c (HandleOneXEvent): Handle events for test surfaces. * xdg_surface.c (FreeRecords): Cancel idle callback if necessary. (BufferIdleCallback): Remove extra whitespace. (XLGetXdgSurface): Fix coding style.
This commit is contained in:
parent
4e9a442856
commit
2230f5e406
7 changed files with 57 additions and 82 deletions
1
12to11.c
1
12to11.c
|
@ -245,6 +245,7 @@ XLMain (int argc, char **argv)
|
||||||
XLInitKeyboardShortcutsInhibit ();
|
XLInitKeyboardShortcutsInhibit ();
|
||||||
XLInitIdleInhibit ();
|
XLInitIdleInhibit ();
|
||||||
XLInitPointerGestures ();
|
XLInitPointerGestures ();
|
||||||
|
XLInitTest ();
|
||||||
|
|
||||||
/* This has to come after the rest of the initialization. */
|
/* This has to come after the rest of the initialization. */
|
||||||
DetermineServerTime ();
|
DetermineServerTime ();
|
||||||
|
|
|
@ -17,6 +17,13 @@
|
||||||
WAYLAND_SCANNER = wayland-scanner
|
WAYLAND_SCANNER = wayland-scanner
|
||||||
XSHMFENCELIB = -lxshmfence
|
XSHMFENCELIB = -lxshmfence
|
||||||
|
|
||||||
|
/* The following libraries are used for tests. */
|
||||||
|
|
||||||
|
WAYLAND_CLIENT = -lwayland-client
|
||||||
|
PNG = -lpng
|
||||||
|
|
||||||
|
XCOMM #define BuildTests
|
||||||
|
|
||||||
/* Uncomment the following code if building with EGL support. */
|
/* Uncomment the following code if building with EGL support. */
|
||||||
|
|
||||||
XCOMM #define HaveEglSupport
|
XCOMM #define HaveEglSupport
|
||||||
|
|
72
Imakefile
72
Imakefile
|
@ -5,41 +5,24 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SYS_LIBRARIES = MathLibrary ThreadsLibraries
|
SYS_LIBRARIES = MathLibrary ThreadsLibraries
|
||||||
DEPLIBS = $(DEPXLIB) $(DEPEXTENSIONLIB) $(DEPXRANDRLIB) $(DEPXRENDERLIB) \
|
DEPLIBS = $(DEPXLIB) $(DEPEXTENSIONLIB) $(DEPXRANDRLIB) $(DEPXRENDERLIB) $(DEPXFIXESLIB) $(DEPXILIB) $(DEPXKBFILELIB)
|
||||||
$(DEPXFIXESLIB) $(DEPXILIB) $(DEPXKBFILELIB)
|
LOCAL_LIBRARIES = $(XLIB) $(EXTENSIONLIB) $(XCBLIB) $(XCB) $(XCB_SHM) $(XRANDRLIB) $(PIXMAN) $(XRENDERLIB) $(XILIB) $(XKBFILELIB) $(XFIXESLIB) $(XCB_DRI3) $(XCB_SHAPE) $(WAYLAND_SERVER) $(XCB_RANDR) $(DRM) $(XPRESENTLIB) $(XSHMFENCELIB)
|
||||||
|
|
||||||
LOCAL_LIBRARIES = $(XLIB) $(EXTENSIONLIB) $(XCBLIB) $(XCB) $(XCB_SHM) \
|
|
||||||
$(XRANDRLIB) $(PIXMAN) $(XRENDERLIB) $(XILIB) $(XKBFILELIB) $(XFIXESLIB) \
|
|
||||||
$(XCB_DRI3) $(XCB_SHAPE) $(WAYLAND_SERVER) $(XCB_RANDR) $(DRM) \
|
|
||||||
$(XPRESENTLIB) $(XSHMFENCELIB)
|
|
||||||
|
|
||||||
INCLUDES := $(DRMINCLUDES) $(PIXMANINCLUDES)
|
INCLUDES := $(DRMINCLUDES) $(PIXMANINCLUDES)
|
||||||
|
|
||||||
SRCS = 12to11.c run.c alloc.c fns.c output.c compositor.c \
|
#ifdef BuildTests
|
||||||
surface.c region.c shm.c atoms.c subcompositor.c positioner.c \
|
# define IHaveSubdirs
|
||||||
xdg_wm.c xdg_surface.c xdg_toplevel.c frame_clock.c xerror.c \
|
# define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)'
|
||||||
ewmh.c timer.c subsurface.c seat.c data_device.c xdg_popup.c \
|
SUBDIRS = tests
|
||||||
dmabuf.c buffer.c select.c xdata.c xsettings.c dnd.c \
|
|
||||||
icon_surface.c primary_selection.c renderer.c \
|
|
||||||
picture_renderer.c explicit_synchronization.c transform.c \
|
|
||||||
wp_viewporter.c decoration.c text_input.c \
|
|
||||||
single_pixel_buffer.c drm_lease.c pointer_constraints.c \
|
|
||||||
time.c relative_pointer.c keyboard_shortcuts_inhibit.c \
|
|
||||||
idle_inhibit.c process.c fence_ring.c pointer_gestures.c
|
|
||||||
|
|
||||||
OBJS = 12to11.o run.o alloc.o fns.o output.o compositor.o \
|
MakeSubdirs($(SUBDIRS))
|
||||||
surface.o region.o shm.o atoms.o subcompositor.o positioner.o \
|
DependSubdirs($(SUBDIRS))
|
||||||
xdg_wm.o xdg_surface.o xdg_toplevel.o frame_clock.o xerror.o \
|
#endif
|
||||||
ewmh.o timer.o subsurface.o seat.o data_device.o xdg_popup.o \
|
|
||||||
dmabuf.o buffer.o select.o xdata.o xsettings.o dnd.o \
|
|
||||||
icon_surface.o primary_selection.o renderer.o \
|
|
||||||
picture_renderer.o explicit_synchronization.o transform.o \
|
|
||||||
wp_viewporter.o decoration.o text_input.o \
|
|
||||||
single_pixel_buffer.o drm_lease.o pointer_constraints.o \
|
|
||||||
time.o relative_pointer.o keyboard_shortcuts_inhibit.o \
|
|
||||||
idle_inhibit.o process.o fence_ring.o pointer_gestures.o
|
|
||||||
|
|
||||||
|
SRCS = 12to11.c run.c alloc.c fns.c output.c compositor.c surface.c region.c shm.c atoms.c subcompositor.c positioner.c xdg_wm.c xdg_surface.c xdg_toplevel.c frame_clock.c xerror.c ewmh.c timer.c subsurface.c seat.c data_device.c xdg_popup.c dmabuf.c buffer.c select.c xdata.c xsettings.c dnd.c icon_surface.c primary_selection.c renderer.c picture_renderer.c explicit_synchronization.c transform.c wp_viewporter.c decoration.c text_input.c single_pixel_buffer.c drm_lease.c pointer_constraints.c time.c relative_pointer.c keyboard_shortcuts_inhibit.c idle_inhibit.c process.c fence_ring.c pointer_gestures.c test.c buffer_release.c
|
||||||
|
OBJS = 12to11.o run.o alloc.o fns.o output.o compositor.o surface.o region.o shm.o atoms.o subcompositor.o positioner.o xdg_wm.o xdg_surface.o xdg_toplevel.o frame_clock.o xerror.o ewmh.o timer.o subsurface.o seat.o data_device.o xdg_popup.o dmabuf.o buffer.o select.o xdata.o xsettings.o dnd.o icon_surface.o primary_selection.o renderer.o picture_renderer.o explicit_synchronization.o transform.o wp_viewporter.o decoration.o text_input.o single_pixel_buffer.o drm_lease.o pointer_constraints.o time.o relative_pointer.o keyboard_shortcuts_inhibit.o idle_inhibit.o process.o fence_ring.o pointer_gestures.o test.o buffer_release.o
|
||||||
GENHEADERS = transfer_atoms.h drm_modifiers.h
|
GENHEADERS = transfer_atoms.h drm_modifiers.h
|
||||||
|
HEADER = $(GENHEADERS) compositor.h
|
||||||
|
EXTRA_DEFINES := -D_GNU_SOURCE -U_BSD_SOURCE -U_SVID_SOURCE
|
||||||
|
|
||||||
#ifdef HaveEglSupport
|
#ifdef HaveEglSupport
|
||||||
|
|
||||||
|
@ -64,25 +47,7 @@ cleandir::
|
||||||
|
|
||||||
OPTIMIZE = -O0
|
OPTIMIZE = -O0
|
||||||
ANALYZE = -fanalyzer
|
ANALYZE = -fanalyzer
|
||||||
|
CDEBUGFLAGS := -fno-common -Wall -Warith-conversion -Wdate-time -Wdisabled-optimization -Wdouble-promotion -Wduplicated-cond -Wextra -Wformat-signedness -Winit-self -Winvalid-pch -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wmissing-prototypes -Wnested-externs -Wnull-dereference -Wold-style-definition -Wopenmp-simd -Wpacked -Wpointer-arith -Wstrict-prototypes -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wsuggest-final-methods -Wsuggest-final-types -Wuninitialized -Wunknown-pragmas -Wunused-macros -Wvariadic-macros -Wvector-operation-performance -Wwrite-strings -Warray-bounds=2 -Wattribute-alias=2 -Wformat=2 -Wformat-truncation=2 -Wimplicit-fallthrough=5 -Wshift-overflow=2 -Wuse-after-free=3 -Wvla-larger-than=4031 -Wredundant-decls -Wno-missing-field-initializers -Wno-override-init -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter -Wno-format-nonliteral -g3 $(OPTIMIZE) $(ANALYZE)
|
||||||
CDEBUGFLAGS := -fno-common -Wall -Warith-conversion -Wdate-time \
|
|
||||||
-Wdisabled-optimization -Wdouble-promotion -Wduplicated-cond \
|
|
||||||
-Wextra -Wformat-signedness -Winit-self -Winvalid-pch \
|
|
||||||
-Wlogical-op -Wmissing-declarations -Wmissing-include-dirs \
|
|
||||||
-Wmissing-prototypes -Wnested-externs -Wnull-dereference \
|
|
||||||
-Wold-style-definition -Wopenmp-simd -Wpacked -Wpointer-arith \
|
|
||||||
-Wstrict-prototypes -Wsuggest-attribute=format \
|
|
||||||
-Wsuggest-attribute=noreturn -Wsuggest-final-methods \
|
|
||||||
-Wsuggest-final-types -Wuninitialized -Wunknown-pragmas \
|
|
||||||
-Wunused-macros -Wvariadic-macros \
|
|
||||||
-Wvector-operation-performance -Wwrite-strings \
|
|
||||||
-Warray-bounds=2 -Wattribute-alias=2 -Wformat=2 \
|
|
||||||
-Wformat-truncation=2 -Wimplicit-fallthrough=5 \
|
|
||||||
-Wshift-overflow=2 -Wuse-after-free=3 -Wvla-larger-than=4031 \
|
|
||||||
-Wredundant-decls -Wno-missing-field-initializers \
|
|
||||||
-Wno-override-init -Wno-sign-compare -Wno-type-limits \
|
|
||||||
-Wno-unused-parameter -Wno-format-nonliteral -g3 $(OPTIMIZE) \
|
|
||||||
$(ANALYZE)
|
|
||||||
|
|
||||||
short_types.txt: media_types.txt
|
short_types.txt: media_types.txt
|
||||||
XCOMM Remove all data types starting with application/vnd.
|
XCOMM Remove all data types starting with application/vnd.
|
||||||
|
@ -129,6 +94,7 @@ ScannerTarget(relative-pointer-unstable-v1)
|
||||||
ScannerTarget(keyboard-shortcuts-inhibit-unstable-v1)
|
ScannerTarget(keyboard-shortcuts-inhibit-unstable-v1)
|
||||||
ScannerTarget(idle-inhibit-unstable-v1)
|
ScannerTarget(idle-inhibit-unstable-v1)
|
||||||
ScannerTarget(pointer-gestures-unstable-v1)
|
ScannerTarget(pointer-gestures-unstable-v1)
|
||||||
|
ScannerTarget(12to11-test)
|
||||||
|
|
||||||
/* Make OBJS depend on scanner headers, and depend on both them and SRCS. */
|
/* Make OBJS depend on scanner headers, and depend on both them and SRCS. */
|
||||||
$(OBJS): $(GENHEADERS)
|
$(OBJS): $(GENHEADERS)
|
||||||
|
@ -140,18 +106,12 @@ depend:: $(GENHEADERS) $(SRCS)
|
||||||
cleandir::
|
cleandir::
|
||||||
$(RM) $(GENHEADERS) $(GENSRCS) short_types.txt 12to11.tar.gz
|
$(RM) $(GENHEADERS) $(GENSRCS) short_types.txt 12to11.tar.gz
|
||||||
|
|
||||||
/* Undefine _BSD_SOURCE and _SVID_SOURCE, since both are deprecated
|
|
||||||
and are also superseeded by _GNU_SOURCE. */
|
|
||||||
|
|
||||||
EXTRA_DEFINES := -D_GNU_SOURCE -U_BSD_SOURCE -U_SVID_SOURCE
|
|
||||||
|
|
||||||
ComplexProgramTarget(12to11)
|
ComplexProgramTarget(12to11)
|
||||||
|
|
||||||
.PHONY: dist
|
.PHONY: dist
|
||||||
dist: 12to11.tar.gz
|
dist: 12to11.tar.gz
|
||||||
|
|
||||||
DIST_FILES = Imakefile $(SRCS) media_types.txt shaders.txt *.awk *.xml \
|
DIST_FILES = Imakefile $(SRCS) media_types.txt shaders.txt *.awk *.xml 12to11.man README libraries.def *.h
|
||||||
12to11.man README libraries.def *.h
|
|
||||||
|
|
||||||
/* Include files generated by wayland-scanner, so the target does not
|
/* Include files generated by wayland-scanner, so the target does not
|
||||||
need to have it installed. */
|
need to have it installed. */
|
||||||
|
|
12
compositor.c
12
compositor.c
|
@ -19,9 +19,6 @@ along with 12to11. If not, see <https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
#include "compositor.h"
|
#include "compositor.h"
|
||||||
|
|
||||||
/* List of all resources for our compositor global. */
|
|
||||||
static XLList *all_compositors;
|
|
||||||
|
|
||||||
/* The compositor global. */
|
/* The compositor global. */
|
||||||
static struct wl_global *global_compositor;
|
static struct wl_global *global_compositor;
|
||||||
|
|
||||||
|
@ -41,12 +38,6 @@ CreateRegion (struct wl_client *client,
|
||||||
XLCreateRegion (client, resource, id);
|
XLCreateRegion (client, resource, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
HandleResourceDestroy (struct wl_resource *resource)
|
|
||||||
{
|
|
||||||
all_compositors = XLListRemove (all_compositors, resource);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct wl_compositor_interface wl_compositor_impl =
|
static const struct wl_compositor_interface wl_compositor_impl =
|
||||||
{
|
{
|
||||||
.create_surface = CreateSurface,
|
.create_surface = CreateSurface,
|
||||||
|
@ -69,8 +60,7 @@ HandleBind (struct wl_client *client, void *data,
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_resource_set_implementation (resource, &wl_compositor_impl,
|
wl_resource_set_implementation (resource, &wl_compositor_impl,
|
||||||
NULL, HandleResourceDestroy);
|
NULL, NULL);
|
||||||
all_compositors = XLListPrepend (all_compositors, resource);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
17
compositor.h
17
compositor.h
|
@ -875,6 +875,7 @@ enum _RoleType
|
||||||
XdgType,
|
XdgType,
|
||||||
CursorType,
|
CursorType,
|
||||||
DndIconType,
|
DndIconType,
|
||||||
|
TestSurfaceType,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define RotatesDimensions(transform) \
|
#define RotatesDimensions(transform) \
|
||||||
|
@ -1795,6 +1796,22 @@ extern XSyncFence FenceToXFence (Fence *);
|
||||||
|
|
||||||
extern void XLInitPointerGestures (void);
|
extern void XLInitPointerGestures (void);
|
||||||
|
|
||||||
|
/* Defined in test.c. */
|
||||||
|
|
||||||
|
extern void XLInitTest (void);
|
||||||
|
extern Bool XLHandleOneXEventForTest (XEvent *);
|
||||||
|
|
||||||
|
/* Defined in buffer_release.c. */
|
||||||
|
|
||||||
|
typedef void (*AllReleasedCallback) (void *);
|
||||||
|
typedef struct _BufferReleaseHelper BufferReleaseHelper;
|
||||||
|
|
||||||
|
extern BufferReleaseHelper *MakeBufferReleaseHelper (AllReleasedCallback,
|
||||||
|
void *);
|
||||||
|
extern void FreeBufferReleaseHelper (BufferReleaseHelper *);
|
||||||
|
extern void ReleaseBufferWithHelper (BufferReleaseHelper *, ExtBuffer *,
|
||||||
|
RenderTarget);
|
||||||
|
|
||||||
/* Utility functions that don't belong in a specific file. */
|
/* Utility functions that don't belong in a specific file. */
|
||||||
|
|
||||||
#define ArrayElements(arr) (sizeof (arr) / sizeof (arr)[0])
|
#define ArrayElements(arr) (sizeof (arr) / sizeof (arr)[0])
|
||||||
|
|
8
run.c
8
run.c
|
@ -154,11 +154,6 @@ HandleOneXEvent (XEvent *event)
|
||||||
if (XLHandleOneXEventForIconSurfaces (event))
|
if (XLHandleOneXEventForIconSurfaces (event))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (XLHandleOneXEventForDmabuf (event))
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (XLHandleOneXEventForXData (event))
|
if (XLHandleOneXEventForXData (event))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -170,6 +165,9 @@ HandleOneXEvent (XEvent *event)
|
||||||
|
|
||||||
if (HandleOneXEventForTime (event))
|
if (HandleOneXEventForTime (event))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (XLHandleOneXEventForTest (event))
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -223,6 +223,10 @@ FreeRecords (ReleaseLaterRecord *records)
|
||||||
last = tem;
|
last = tem;
|
||||||
tem = tem->next;
|
tem = tem->next;
|
||||||
|
|
||||||
|
/* Cancel the idle callback if it already exists. */
|
||||||
|
if (last->key)
|
||||||
|
RenderCancelIdleCallback (last->key);
|
||||||
|
|
||||||
/* Release the buffer now. */
|
/* Release the buffer now. */
|
||||||
XLReleaseBuffer (last->buffer);
|
XLReleaseBuffer (last->buffer);
|
||||||
|
|
||||||
|
@ -360,7 +364,6 @@ BufferIdleCallback (RenderBuffer buffer, void *data)
|
||||||
record = data;
|
record = data;
|
||||||
role = record->role;
|
role = record->role;
|
||||||
|
|
||||||
|
|
||||||
XLReleaseBuffer (record->buffer);
|
XLReleaseBuffer (record->buffer);
|
||||||
DeleteRecord (record);
|
DeleteRecord (record);
|
||||||
|
|
||||||
|
@ -1574,8 +1577,7 @@ XLGetXdgSurface (struct wl_client *client, struct wl_resource *resource,
|
||||||
attrs.border_pixel = border_pixel;
|
attrs.border_pixel = border_pixel;
|
||||||
attrs.event_mask = DefaultEventMask;
|
attrs.event_mask = DefaultEventMask;
|
||||||
attrs.cursor = InitDefaultCursor ();
|
attrs.cursor = InitDefaultCursor ();
|
||||||
flags = (CWColormap | CWBorderPixel | CWEventMask
|
flags = CWColormap | CWBorderPixel | CWEventMask | CWCursor;
|
||||||
| CWCursor);
|
|
||||||
|
|
||||||
/* Sentinel node. */
|
/* Sentinel node. */
|
||||||
role->release_records->next = role->release_records;
|
role->release_records->next = role->release_records;
|
||||||
|
|
Loading…
Add table
Reference in a new issue