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

Fix Win32 build, value check warning #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions Makefile.target
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ dummy := $(call unnest-vars,.., \
all-obj-y += $(common-obj-y)
all-obj-$(CONFIG_SOFTMMU) += $(block-obj-y)

ifdef CONFIG_WIN32
LIBS+=-lgdi32
endif

ifndef CONFIG_HAIKU
LIBS+=-lm
endif
Expand Down
18 changes: 16 additions & 2 deletions hw/vigs/vigs_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,24 @@
#include "hw/work_queue.h"
#include "ui/console.h"
#include "qemu/main-loop.h"
#ifndef _WIN32
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#endif

#define PCI_VENDOR_ID_VIGS 0x19B2
#define PCI_DEVICE_ID_VIGS 0x1011

#define VIGS_IO_SIZE 0x1000

#ifdef _WIN32
void *vigs_display = NULL;
#else
Display *vigs_display = NULL;
XVisualInfo *vigs_visual_info = NULL;
#endif
struct work_queue *vigs_render_queue = NULL;
struct winsys_interface *vigs_wsi = NULL;
XVisualInfo *vigs_visual_info = NULL;

typedef struct VIGSState
{
Expand Down Expand Up @@ -78,10 +84,12 @@ typedef struct VIGSState
uint32_t reg_int;
} VIGSState;

#ifndef _WIN32
static int x_error_handler(Display *dpy, XErrorEvent *e)
{
return 0;
}
#endif

#define TYPE_VIGS_DEVICE "vigs"

Expand Down Expand Up @@ -284,6 +292,8 @@ static int vigs_device_init(PCIDevice *dev)
{
VIGSState *s = DO_UPCAST(VIGSState, dev.pci_dev, dev);
struct vigs_backend *backend = NULL;

#ifndef _WIN32
char buff[100];

XSetErrorHandler(x_error_handler);
Expand All @@ -295,6 +305,7 @@ static int vigs_device_init(PCIDevice *dev)
fprintf(stderr, "Cannot open X display\n");
exit(1);
}
#endif

vigs_render_queue = work_queue_create("render_queue");

Expand Down Expand Up @@ -336,9 +347,12 @@ static int vigs_device_init(PCIDevice *dev)
goto fail;
}

#ifndef _WIN32
sprintf(buff, "0x%lX", vigs_visual_info->visualid);
setenv("SDL_VIDEO_X11_VISUALID", buff, 1);

setenv("SDL_VIDEO_X11_VISUALID", buff, 1);
#endif

s->fenceman = vigs_fenceman_create();

s->fence_ack_bh = qemu_bh_new(vigs_fence_ack_bh, s);
Expand Down
4 changes: 3 additions & 1 deletion hw/vigs/vigs_gl_backend_wgl.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
#include <GL/gl.h>
#include <GL/wglext.h>

HWND vigs_window = 0;

#define VIGS_WGL_WIN_CLASS "VIGSWinClass"

#define VIGS_WGL_GET_PROC(proc_type, proc_name, label) \
Expand Down Expand Up @@ -709,7 +711,7 @@ struct vigs_backend *vigs_gl_backend_create(void *display)
}

VIGS_LOG_DEBUG("created");

return &gl_backend_wgl->base.base;

fail:
Expand Down
2 changes: 1 addition & 1 deletion hw/virtio/virtio-rng.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ static void virtio_rng_device_realize(DeviceState *dev, Error **errp)
VirtIORNG *vrng = VIRTIO_RNG(dev);
Error *local_err = NULL;

if (!vrng->conf.period_ms > 0) {
if (vrng->conf.period_ms <= 0) {
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "period",
"a positive number");
return;
Expand Down
4 changes: 4 additions & 0 deletions hw/yagl/yagl_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@

struct work_queue;

#ifdef _WIN32
extern void *vigs_display;
#else
extern Display *vigs_display;
#endif
extern struct work_queue *vigs_render_queue;
extern struct winsys_interface *vigs_wsi;

Expand Down
8 changes: 8 additions & 0 deletions ui/sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@
#include "x_keymap.h"
#include "sdl_zoom.h"

#ifdef _WIN32
extern HWND vigs_window;
#else
extern Window vigs_window;
#endif
extern uint32_t vigs_window_width;
extern uint32_t vigs_window_height;

Expand Down Expand Up @@ -971,7 +975,11 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame)
fprintf(stderr, "Cannot get SDL WM info\n");
exit(1);
}
#ifdef _WIN32
vigs_window = wm_info.window;
#else
vigs_window = wm_info.info.x11.window;
#endif
}
}
#endif