rendered paste body=== modified file 'common.mak'
--- common.mak 2007-12-26 04:19:37 +0000
+++ common.mak 2007-12-27 19:00:37 +0000
@@ -57,6 +57,6 @@
.c.o: ; $(C) $(STDFLAGS) $(CFLAGS) -c $<
DO_MAKE = @for i in $(SUBDIRS); do $(MAKE) -C $$i || break; done
-DO_MAKECLEAN = @for i in `ls | grep -v '[^a-z0-9]'`; do $(MAKE) -C $$i clean; done
+DO_MAKECLEAN = @find ./ -mindepth 2 -maxdepth 2 -name 'Makefile' -type f | sed 's/[mM]akefile$$//g' | xargs -I '{}' make -C '{}' clean
LIBTOOL_OPTS = --tag=CXX
=== modified file 'plugins/feature/common-feature.cpp'
--- plugins/feature/common-feature.cpp 2007-12-27 01:15:54 +0000
+++ plugins/feature/common-feature.cpp 2007-12-27 12:55:07 +0000
@@ -60,7 +60,7 @@
release_exclusive_access();
S_SSaverobj::get_instance()->ResetCounter();
-
+ Render * render = S_Render::get_instance();
render->prepare_new_image();
render->clear();
render->draw("clear");
=== modified file 'plugins/input/keyboard/keyboard.cpp'
--- plugins/input/keyboard/keyboard.cpp 2007-11-17 23:07:41 +0000
+++ plugins/input/keyboard/keyboard.cpp 2007-12-27 14:25:21 +0000
@@ -4,6 +4,7 @@
#ifdef use_sdl
#include "common.hpp"
+#include "renderer.hpp"
#endif
using std::list;
@@ -75,9 +76,13 @@
string Keyboard::getSDLkey()
{
SDL_KeyboardEvent event;
+ Render * ren = S_Render::get_instance();
+ if (SDL_WaitEvent(reinterpret_cast<SDL_Event *>(&event))){
+ if (event.type == SDL_VIDEOEXPOSE){
+ ren->device->refresh_screen();
+ }
- if (SDL_WaitEvent(reinterpret_cast<SDL_Event *>(&event))) {
- if (event.type == SDL_KEYDOWN) {
+ else if (event.type == SDL_KEYDOWN) {
return get_key_string(event.keysym.sym);
} else if (event.type == SDL_KEYUP && event.keysym.sym == SDLK_UNKNOWN ) {
char kbuf[10] = {0};
@@ -95,7 +100,7 @@
this_time = (unsigned long long) tv.tv_sec*1000+tv.tv_usec/1000;
if (next_time <= this_time) {
next_time = (unsigned long long) tv.tv_sec*1000+tv.tv_usec/1000 + 200;
- S_Touch::get_instance()->got_input(x, y);
+ S_Touch::get_instance()->got_input(ren->device->convert_xmouse(x), ren->device->convert_ymouse(y));
return "touch_input";
}
}
=== modified file 'plugins/output/opengl/SDL_GLout.cpp'
--- plugins/output/opengl/SDL_GLout.cpp 2007-12-21 20:47:44 +0000
+++ plugins/output/opengl/SDL_GLout.cpp 2007-12-27 12:55:07 +0000
@@ -95,6 +95,42 @@
str = " " + str;
return ( str.find(" " + name + " ", 0) != std::string::npos);
}
+
+void SDL_GLout::PrintGLStuff(){ //Prints various OpenGL details
+ const char *vendor = reinterpret_cast<const char *>(glGetString(GL_VENDOR));
+ const char *renderer = reinterpret_cast<const char *>(glGetString(GL_RENDERER));
+ const char *version = reinterpret_cast<const char *>( glGetString(GL_VERSION));
+ const char *p = reinterpret_cast<const char *>(glGetString(GL_EXTENSIONS));
+ if (vendor == NULL || renderer == NULL || version == NULL || p == NULL){
+ fprintf(stderr,OBJOUTPUT("Critical error: glGetString failed\n"));
+ ::exit(1);
+ }
+ //let's format the extension list a little better
+ std::string str(p);
+ std::string replacement1("\n ");
+ std::string replacement2(", ");
+ unsigned int z = 0, x = 0;
+ while ((z = str.find(" ", z))!= std::string::npos && z+1 < str.size()){
+ if (x == 2){
+ str.replace(z,1,replacement2 + replacement1);
+ x = 0;
+ z+=replacement1.size() + replacement2.size();
+ }
+ else{
+ str.replace(z,1,replacement2);
+ x++;
+ z+=replacement2.size();
+ }
+ }
+
+ fprintf(stderr,OBJOUTPUT("Opengl vendor: %s\n"), vendor);
+ fprintf(stderr,OBJOUTPUT("Opengl renderer: %s\n"), renderer);
+ fprintf(stderr,OBJOUTPUT("Opengl version: %s\n"), version);
+ fprintf(stderr,OBJOUTPUT("Opengl extensions:%s%s\n\n"), replacement1.c_str(),str.c_str());
+
+}
+
+
bool SDL_GLout::Init(int x, int y, bool fullscreen, const std::string& caption, bool handle_input, int _real_x, int _real_y){
//purpose of this is to protect with locks the //real init stuff
pthread_mutex_lock(&initmutex);
@@ -121,9 +157,11 @@
pthread_mutex_lock(&drawmutex);
pthread_mutex_lock(&inputmutex);
quit = true;
- pthread_mutex_unlock(&drawmutex);
pthread_mutex_unlock(&inputmutex);
+ SDL_Event event;
+ SDL_PushEvent(&event);
pthread_join(input_thread, NULL);
+ pthread_mutex_unlock(&drawmutex);
pthread_join(draw_thread, NULL);
}
@@ -138,15 +176,15 @@
x = real_x;
y = real_y;
}
- printf("real_x is %d, real_y is %d\n", real_x, real_y);
+
bool fullscreen = requestedfullscreen;
std::string caption = sdl_caption;
- printf("Parameters x-> %d\ny-> %d\ncaption-> %s\n", x,y,caption.c_str());
+ printf(OBJOUTPUT("Parameters x-> %d\ny-> %d\ncaption-> %s\n"), x,y,caption.c_str());
//we start by creating the SDL contest
if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTTHREAD) < 0) {
- fprintf(stderr, "Video initialization failed: %s\n", SDL_GetError());
+ fprintf(stderr, OBJOUTPUT("Video initialization failed: %s\n"), SDL_GetError());
return false;
}
SDL_SysWMinfo info;
@@ -163,11 +201,10 @@
info.info.x11.unlock_func();
if (x11_width < x || x11_height < y) {
- fprintf(stderr, "Requested resolution is higher than X resolution!\n");
+ fprintf(stderr, OBJOUTPUT("Requested resolution is higher than X resolution!\n"));
SDL_Quit();
- ::exit(1);
+ return false;
}
-
}
screeninfo = SDL_GetVideoInfo();
@@ -213,7 +250,7 @@
glClearColor(0.0f, 0.0f, 0.0f, 0.0f); //Clear screen
glDisable(GL_DEPTH); //We only do 2D rendering
-
+ PrintGLStuff();
if (openglmode != 2 && !CheckGLExt("GL_ARB_pixel_buffer_object") && !CheckGLExt("GL_EXT_pixel_buffer_object")){
fprintf(stderr,
OBJOUTPUT("SDL_GLout::This video card does not support the extension: GL_ARB_pixel_buffer_object\n"));
@@ -395,7 +432,7 @@
glDeleteTextures(NUM_OF_LAYOUTS, texnums);
thisobj->_glDeleteBuffersARB(NUM_OF_LAYOUTS, bufnums);
-
+ SDL_Quit();
pthread_mutex_unlock(&thisobj->drawmutex);
return 0;
};
@@ -407,17 +444,21 @@
fprintf(stderr, OBJOUTPUT("SDL event handling is disabled\n"));
return 0;
}
+ else
+ fprintf(stderr, OBJOUTPUT("SDL event handling is enabled\n"));
SDL_Event event[1];
SDL_EventState(SDL_SYSWMEVENT,SDL_ENABLE);
- thisobj->WaitForInit();
+ if(!thisobj->WaitForInit())
+ return 0;
pthread_mutex_lock(&thisobj->inputmutex);
SDL_InitSubSystem( SDL_INIT_EVENTTHREAD);
thisobj->KeyboardLoopRunning = true;
while (!thisobj->quit) {
pthread_mutex_unlock(&thisobj->inputmutex);
if (SDL_WaitEvent(event)){
-
pthread_mutex_lock(&thisobj->inputmutex);
+ if (thisobj->quit)
+ break;
switch (event[0].type) {
case SDL_QUIT:
thisobj->HoldDrawing();
@@ -439,9 +480,9 @@
break;
case SDLK_F1:
- thisobj->HoldDrawing();
- thisobj->NeedsFullScreenToggling = true;
- thisobj->ReleaseDrawing();
+// thisobj->HoldDrawing();
+// thisobj->NeedsFullScreenToggling = true;
+// thisobj->ReleaseDrawing();
break;
default:
=== modified file 'plugins/output/opengl/SDL_GLout.h'
--- plugins/output/opengl/SDL_GLout.h 2007-12-21 20:47:44 +0000
+++ plugins/output/opengl/SDL_GLout.h 2007-12-27 12:55:07 +0000
@@ -167,6 +167,7 @@
SDL_GLout();//we hide the constructor, since this is going to be "singletoned"
bool _Init();//for internal use only
bool CheckGLExt(const std::string& name);
+ void PrintGLStuff();
bool IsPo2(int value);
static void * OpenGLThreadLoop(void * ptr);
@@ -244,6 +245,11 @@
void MakeActionsExpire();
void FullScreenToggle();
bool GetFullScreenStatus();
+ void RefreshScreen(){
+ HoldDrawing();
+ NeedsDrawing = true;
+ ReleaseDrawing();
+ }
static SDL_GLout *get_instance(){ //Singleton
pthread_mutex_lock(&sdl_glout_singletonmutex);
=== modified file 'plugins/output/opengl/opengl.cpp'
--- plugins/output/opengl/opengl.cpp 2007-12-21 21:46:31 +0000
+++ plugins/output/opengl/opengl.cpp 2007-12-27 14:28:05 +0000
@@ -15,6 +15,8 @@
//printf("Homedir is %s\n", conf->p_homedir().c_str());
int rw = glconf->p_opengl_w();
int rh = glconf->p_opengl_h();
+ x_ratio = double(width)/(rw!=0?rw:width);
+ y_ratio = double(height)/(rh!=0?rh:height);
#ifdef use_x11
XInitThreads();//TODO: make sure it actually inits multithreading mode
@@ -69,8 +71,10 @@
rgbsurface = SDL_CreateRGBSurface(SDL_SRCALPHA, width, height, 32,
0,0,0,0/*0xFF000000, 0x00FF0000, 0x0000FF00,0x000000FF*/ );
- SDLGL->Init(width,height, static_cast<bool>(conf->p_fullscreen()), "MMS", false, rw, rh);
- SDLGL->WaitForInit();
+ bool handleinput = conf->p_input() != "keyboard";
+ SDLGL->Init(width,height, static_cast<bool>(conf->p_fullscreen()), "MMS", handleinput, rw, rh);
+ if(!SDLGL->WaitForInit())
+ std::exit(1);
render = S_Render::get_instance();
SDLGL->SetLayoutRGB(0,1,1,1);
firstdraw = true;
@@ -228,6 +232,18 @@
SDLGL->ReleaseDrawing(); //we don't block here
}
+void OpenGLdev::refresh_screen(){
+ SDLGL->RefreshScreen();
+}
+
+unsigned int OpenGLdev::convert_xmouse(int x) {
+ return static_cast<unsigned int>(double(x)*x_ratio);
+}
+
+unsigned int OpenGLdev::convert_ymouse(int y) {
+ return static_cast<unsigned int>(double(y)*y_ratio);
+}
+
=== modified file 'plugins/output/opengl/opengl.hpp'
--- plugins/output/opengl/opengl.hpp 2007-12-21 21:46:31 +0000
+++ plugins/output/opengl/opengl.hpp 2007-12-27 13:44:30 +0000
@@ -21,6 +21,8 @@
int height;
bool firstdraw;
void run(){};
+ double x_ratio;
+ double y_ratio;
public:
@@ -78,6 +80,10 @@
void reset_layout_attribs_nowait(int layoutnum );
void reset_layout_attribs(int layoutnum );
void make_actions_expire(int layoutnum);
+ void refresh_screen();
+ unsigned int convert_xmouse(int x);
+ unsigned int convert_ymouse(int y);
+
protected:
// Config *conf;
=== modified file 'plugins/output/render_device.hpp'
--- plugins/output/render_device.hpp 2007-12-21 21:46:31 +0000
+++ plugins/output/render_device.hpp 2007-12-27 13:47:43 +0000
@@ -52,6 +52,8 @@
virtual ~RenderDevice() {};
RenderDevice();
+ virtual unsigned int convert_xmouse(int x) {return x;}
+ virtual unsigned int convert_ymouse(int y) {return y;}
//opengl specific
@@ -84,6 +86,7 @@
virtual void reset_layout_attribs_nowait(int = -1) {};
virtual void reset_layout_attribs(int = -1) {};
virtual void make_actions_expire(int) {};
+ virtual void refresh_screen(){};
protected:
Config *conf;
=== modified file 'plugins/output/sdl/sdlout.cpp'
--- plugins/output/sdl/sdlout.cpp 2007-12-27 01:15:54 +0000
+++ plugins/output/sdl/sdlout.cpp 2007-12-27 12:55:07 +0000
@@ -51,6 +51,9 @@
void SDLdev::init()
{
+#ifdef use_x11
+ XInitThreads();// enable thead safe mode in X
+#endif
if(SDL_Init(SDL_INIT_VIDEO) < 0) {
print_critical(dgettext("mms-sdl", "Could not initialize") + std::string(" ") + SDL_GetError(), "SDL");
std::exit(1);
=== modified file 'theme.cpp'
--- theme.cpp 2007-12-21 20:47:44 +0000
+++ theme.cpp 2007-12-27 12:55:07 +0000
@@ -61,7 +61,7 @@
render->device->animation_section_begin();
int curlayer = render->device->get_current_layer();
- render->device->switch_to_layer(1);
+ render->device->switch_to_layer(curlayer+1);
render->device->reset_layout_attribs_nowait();
render->device->animation_fade(0,1,40,1);
render->device->animation_section_end();
@@ -127,10 +127,9 @@
}
exit_loop = false;
-
+ render->device->animation_section_begin();
+ render->device->layer_active_no_wait(false);
render->device->switch_to_layer(curlayer);
- render->device->layer_active_no_wait(false);
- render->device->animation_section_begin();
render->device->animation_fade(0,1,80,curlayer);
render->device->animation_section_end();