summaryrefslogtreecommitdiff
path: root/libwinnie/src/sdl
diff options
context:
space:
mode:
Diffstat (limited to 'libwinnie/src/sdl')
-rw-r--r--libwinnie/src/sdl/gfx.cc26
-rw-r--r--libwinnie/src/sdl/gfx.h3
-rw-r--r--libwinnie/src/sdl/keyboard.cc9
-rw-r--r--libwinnie/src/sdl/keyboard.h3
-rw-r--r--libwinnie/src/sdl/mouse.cc20
-rw-r--r--libwinnie/src/sdl/mouse.h3
6 files changed, 14 insertions, 50 deletions
diff --git a/libwinnie/src/sdl/gfx.cc b/libwinnie/src/sdl/gfx.cc
index 5671764..a955358 100644
--- a/libwinnie/src/sdl/gfx.cc
+++ b/libwinnie/src/sdl/gfx.cc
@@ -23,9 +23,9 @@ Author: Eleni Maria Stea <elene.mst@gmail.com>
#include <stdio.h>
#include <stdlib.h>
#include <SDL/SDL.h>
+#include <stdint.h>
#include "sdl/gfx.h"
-#include "shalloc.h"
#include "winnie.h"
static SDL_Surface *fbsurf;
@@ -46,11 +46,11 @@ bool init_gfx()
return false;
}
- if(!(gfx = (Graphics*)sh_malloc(sizeof *gfx))) {
+ if(!(gfx = (Graphics*)malloc(sizeof *gfx))) {
return false;
}
- get_subsys()->graphics_offset = (int)((char*)gfx - (char*)get_pool());
+ get_subsys()->graphics_offset = (intptr_t)(gfx);
Rect scr_rect(0, 0, 1280, 853);
gfx->screen_rect = scr_rect;
@@ -62,7 +62,7 @@ bool init_gfx()
}
SDL_ShowCursor(0);
- if(!(gfx->pixmap = (Pixmap*)sh_malloc(sizeof(Pixmap)))) {
+ if(!(gfx->pixmap = (Pixmap*)malloc(sizeof(Pixmap)))) {
fprintf(stderr, "Failed to allocate pixmap.\n");
return false;
}
@@ -71,7 +71,7 @@ bool init_gfx()
gfx->pixmap->height = gfx->screen_rect.height;
int fbsize = gfx->pixmap->width * gfx->pixmap->height * gfx->color_depth / 8;
- if(!(gfx->pixmap->pixels = (unsigned char*)sh_malloc(fbsize))) {
+ if(!(gfx->pixmap->pixels = (unsigned char*)malloc(fbsize))) {
fprintf(stderr, "failed to allocate the pixmap framebuffer.\n");
return false;
}
@@ -83,23 +83,13 @@ bool init_gfx()
void destroy_gfx()
{
- sh_free(gfx->pixmap->pixels);
+ free(gfx->pixmap->pixels);
gfx->pixmap->pixels = 0;
- sh_free(gfx->pixmap);
- sh_free(gfx);
+ free(gfx->pixmap);
+ free(gfx);
SDL_Quit();
}
-bool client_open_gfx(void *smem_start, int offset)
-{
- gfx = (Graphics*)((unsigned char*)smem_start + offset);
- return true;
-}
-
-void client_close_gfx()
-{
-}
-
unsigned char *get_framebuffer()
{
return gfx->pixmap->pixels;
diff --git a/libwinnie/src/sdl/gfx.h b/libwinnie/src/sdl/gfx.h
index cb1c7ef..c14c22a 100644
--- a/libwinnie/src/sdl/gfx.h
+++ b/libwinnie/src/sdl/gfx.h
@@ -28,9 +28,6 @@ Author: Eleni Maria Stea <elene.mst@gmail.com>
bool init_gfx();
void destroy_gfx();
-bool client_open_gfx(void *smem_start, int offset);
-void client_close_gfx();
-
unsigned char *get_framebuffer();
Pixmap *get_framebuffer_pixmap();
diff --git a/libwinnie/src/sdl/keyboard.cc b/libwinnie/src/sdl/keyboard.cc
index b9241f4..93f2e20 100644
--- a/libwinnie/src/sdl/keyboard.cc
+++ b/libwinnie/src/sdl/keyboard.cc
@@ -37,15 +37,6 @@ void destroy_keyboard()
{
}
-bool client_open_keyboard(void *smem_start, int offset)
-{
- return true;
-}
-
-void client_close_keyboard()
-{
-}
-
int get_keyboard_fd()
{
return -1;
diff --git a/libwinnie/src/sdl/keyboard.h b/libwinnie/src/sdl/keyboard.h
index 4d55cba..548ddbb 100644
--- a/libwinnie/src/sdl/keyboard.h
+++ b/libwinnie/src/sdl/keyboard.h
@@ -25,9 +25,6 @@ Author: Eleni Maria Stea <elene.mst@gmail.com>
bool init_keyboard();
void destroy_keyboard();
-bool client_open_keyboard(void *smem_start, int offset);
-void client_close_keyboard();
-
int get_keyboard_fd();
void process_keyboard_event();
diff --git a/libwinnie/src/sdl/mouse.cc b/libwinnie/src/sdl/mouse.cc
index 80f33fb..b5eac68 100644
--- a/libwinnie/src/sdl/mouse.cc
+++ b/libwinnie/src/sdl/mouse.cc
@@ -22,8 +22,10 @@ Author: Eleni Maria Stea <elene.mst@gmail.com>
#ifdef WINNIE_SDL
#include <SDL/SDL.h>
+#include <stdlib.h>
+#include <stdint.h>
+
#include "sdl/mouse.h"
-#include "shalloc.h"
#include "wm.h"
#include "window.h"
#include "winnie.h"
@@ -40,10 +42,10 @@ static Mouse *mouse;
bool init_mouse()
{
- if(!(mouse = (Mouse*)sh_malloc(sizeof *mouse))) {
+ if(!(mouse = (Mouse*)malloc(sizeof *mouse))) {
return false;
}
- get_subsys()->mouse_offset = (int)((char*)mouse - (char*)get_pool());
+ get_subsys()->mouse_offset = (intptr_t)(mouse);
memset(mouse, 0, sizeof *mouse);
return true;
@@ -51,17 +53,7 @@ bool init_mouse()
void destroy_mouse()
{
- sh_free(mouse);
-}
-
-bool client_open_mouse(void *smem_start, int offset)
-{
- mouse = (Mouse*)((unsigned char*)smem_start + offset);
- return true;
-}
-
-void client_close_mouse()
-{
+ free(mouse);
}
void set_mouse_bounds(const Rect &rect)
diff --git a/libwinnie/src/sdl/mouse.h b/libwinnie/src/sdl/mouse.h
index 9e55496..6fbe711 100644
--- a/libwinnie/src/sdl/mouse.h
+++ b/libwinnie/src/sdl/mouse.h
@@ -27,9 +27,6 @@ struct Rect;
bool init_mouse();
void destroy_mouse();
-bool client_open_mouse(void *smem_start, int offset);
-void client_close_mouse();
-
void set_mouse_bounds(const Rect &rect);
int get_mouse_fd();