Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use FD passing for shared memory #78

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ Build-Depends:
libvchan-xen-dev,
python3-dev,
libpulse-dev,
libxext-dev,
libxrandr-dev,
libxcb1-dev,
libxcb-util0-dev,
libxcb-shm0-dev,
libx11-xcb-dev,
libconfig-dev,
libpng-dev,
Expand All @@ -21,8 +22,8 @@ Build-Depends:
help2man
Standards-Version: 4.1.3
Homepage: https://qubes-os.org/
#Vcs-Browser: https://github.com/QubesOS/qubes-gui-daemon
#Vcs-Git: https://github.com/QubesOS/qubes-gui-daemon.git
Vcs-Browser: https://github.com/QubesOS/qubes-gui-daemon
Vcs-Git: https://github.com/QubesOS/qubes-gui-daemon.git

Package: qubes-gui-daemon
Architecture: any
Expand Down
3 changes: 3 additions & 0 deletions gui-common/error.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ int dummy_handler(Display * dpy, XErrorEvent * ev)
sizeof(buf));
fprintf(stderr, " Minor opcode: %d (%s)\n",
ev->minor_code, buf);
} else {
fprintf(stderr, " Minor opcode: %d\n",
ev->minor_code);
}

/* Provide value information */
Expand Down
2 changes: 1 addition & 1 deletion gui-daemon/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
MAKEFLAGS := -rR
VCHAN_PKG = $(if $(BACKEND_VMM),vchan-$(BACKEND_VMM),vchan)
CC=gcc
pkgs := x11 xext x11-xcb xcb glib-2.0 $(VCHAN_PKG) libpng libnotify libconfig
pkgs := x11 x11-xcb xcb xcb-shm xcb-aux glib-2.0 $(VCHAN_PKG) libpng libnotify libconfig
objs := xside.o png.o trayicon.o ../gui-common/double-buffer.o ../gui-common/txrx-vchan.o \
../gui-common/error.o list.o
extra_cflags := -I../include/ -g -O2 -Wall -Wextra -Werror -pie -fPIC \
Expand Down
24 changes: 14 additions & 10 deletions gui-daemon/trayicon.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <xcb/xcb.h>
#include <math.h>
#include "xside.h"
#include <util.h>

/* initialization required for TRAY_BACKGROUND mode */
void init_tray_bg(Ghandles *g) {
Expand All @@ -45,7 +47,7 @@ void fill_tray_bg_and_update(Ghandles *g, struct windowdata *vm_window,
size_t data_sz;
int xp, yp;

if (!vm_window->image) {
if (vm_window->shmseg == QUBES_NO_SHM_SEGMENT) {
/* TODO: implement screen_window handling */
return;
}
Expand Down Expand Up @@ -77,10 +79,11 @@ void fill_tray_bg_and_update(Ghandles *g, struct windowdata *vm_window,
vm_window->image_width,
vm_window->image_height,
24);
XShmPutImage(g->display, pixmap, g->context,
vm_window->image, 0, 0, 0, 0,
vm_window->image_width,
vm_window->image_height, 0);
put_shm_image(g, pixmap, vm_window,
0, 0,
vm_window->image_width,
vm_window->image_height,
0, 0);
XImage *image = XGetImage(g->display, pixmap, 0, 0, w, h,
0xFFFFFFFF, ZPixmap);
/* Use top-left corner pixel color as transparency color */
Expand Down Expand Up @@ -231,7 +234,7 @@ void tint_tray_and_update(Ghandles *g, struct windowdata *vm_window,
uint32_t pixel;
double h_ignore, l, s_ignore;

if (!vm_window->image) {
if (vm_window->shmseg == QUBES_NO_SHM_SEGMENT) {
/* TODO: implement screen_window handling */
return;
}
Expand All @@ -245,10 +248,11 @@ void tint_tray_and_update(Ghandles *g, struct windowdata *vm_window,
vm_window->image_width,
vm_window->image_height,
24);
XShmPutImage(g->display, pixmap, g->context,
vm_window->image, 0, 0, 0, 0,
vm_window->image_width,
vm_window->image_height, 0);
put_shm_image(g, pixmap, vm_window,
0, 0,
vm_window->image_width,
vm_window->image_height,
0, 0);
XImage *image = XGetImage(g->display, pixmap, x, y, w, h,
0xFFFFFFFF, ZPixmap);
/* tint image */
Expand Down
Loading