## This patch reduces the memory-consumption, especially if texture-compression gets activated ## activate compression by putting "compression 1" into your 3ddesktop.conf ## It also fixes a little problem with the acquiry-timing. ## config->options->acquire was assigned 1 bit only, but it needs to be at least int to be useable diff -u 3ddesktop-0.2.5/3ddeskd.cpp 3ddesktop-0.2.5.1/3ddeskd.cpp --- 3ddesktop-0.2.5/3ddeskd.cpp 2003-03-15 04:08:31.000000000 +0100 +++ 3ddesktop-0.2.5.1/3ddeskd.cpp 2003-09-14 18:07:05.794179264 +0200 @@ -1392,7 +1392,7 @@ if (msgmgr.msg.reload) cfg->reload(); - + if (GLWin.grab_screenshot_data() < 0) { msgout (ERROR, "couldn't grab screen image\n"); end_program(-1); @@ -1401,7 +1401,6 @@ face_set->load_texture_data(current_col + (current_row * col_count), cfg->texture_size, GLWin.get_screenshot_data_ptr() ); - continue; // don't activate break; @@ -1421,7 +1420,7 @@ msgout (DEBUG, "acquire sleep is %d\n", msgmgr.msg.acquire_sleep); sleep_ms (msgmgr.msg.acquire_sleep); } - + if (GLWin.grab_screenshot_data() < 0) { msgout (ERROR, "couldn't grab screen image\n"); end_program(-1); @@ -1984,8 +1983,10 @@ vdesks.set_vdesktop (j, i); - if (cfg->options->acquire > 1) + if (cfg->options->acquire > 1) { + msgout (DEBUG, "sleeping", cfg->options->acquire); sleep_ms (cfg->options->acquire); + } if (GLWin.grab_screenshot_data() < 0) { msgout (ERROR, "couldn't grab screen image\n"); @@ -1995,19 +1996,18 @@ face_set->load_texture_data(j + (i * col_count), cfg->texture_size, GLWin.get_screenshot_data_ptr() ); + } } - // go back to current vdesks.set_vdesktop (current_col, current_row); } - + load_digits(); em.add_event (ENTRY_MOVEMENT_START, entry_move_start_hook, NULL, 1); - em.add_event (EXIT_MOVEMENT_START, exit_move_start_hook, NULL, 1); - + em.add_event (EXIT_MOVEMENT_START, exit_move_start_hook, NULL, 1); } // END initialize_3ddesktop diff -u 3ddesktop-0.2.5/3ddesktop.conf 3ddesktop-0.2.5.1/3ddesktop.conf --- 3ddesktop-0.2.5/3ddesktop.conf 2003-03-21 18:19:00.000000000 +0100 +++ 3ddesktop-0.2.5.1/3ddesktop.conf 2003-09-14 18:06:47.669934568 +0200 @@ -33,13 +33,17 @@ # (for debuggin: not really usable at this time) # early_desktop_switch - When desktop is switched (default true) # disable_keys_in_goto - Disable keys while in an automated "goto" (default true) - +# compression - enables texture compression, which saves about +# 16MB of resident memory at the default +# texturesize # # Examples (uncomment to use) # #texturesize 512 +#compression 1 + #wm kde2 diff -u 3ddesktop-0.2.5/config.hpp 3ddesktop-0.2.5.1/config.hpp --- 3ddesktop-0.2.5/config.hpp 2003-03-21 18:09:24.000000000 +0100 +++ 3ddesktop-0.2.5.1/config.hpp 2003-09-14 18:07:02.174729504 +0200 @@ -72,7 +72,8 @@ char name[50]; // bits/bools on/off - int acquire : 1; + int compression : 1; // texture compression +// int acquire : 1; //acquire needs more than 1 bit (10options->compression == 0) + gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, texture_size, texture_size, GL_RGBA, GL_UNSIGNED_BYTE, data); + else gluBuild2DMipmaps(GL_TEXTURE_2D, GL_COMPRESSED_RGBA, texture_size, texture_size, GL_RGBA, GL_UNSIGNED_BYTE, data); } }; diff -u 3ddesktop-0.2.5/win.cpp 3ddesktop-0.2.5.1/win.cpp --- 3ddesktop-0.2.5/win.cpp 2003-02-17 02:53:35.000000000 +0100 +++ 3ddesktop-0.2.5.1/win.cpp 2003-09-14 18:06:58.426299352 +0200 @@ -91,7 +91,7 @@ GLWindow::~GLWindow() { if (screenshot_data) - delete screenshot_data; + delete screenshot_data; } int GLWindow::open_display() @@ -129,7 +129,7 @@ imlib_context_set_anti_alias(1); imlib_context_set_blend(0); - img = imlib_create_image(screen_width, screen_height); + // img = imlib_create_image(screen_width, screen_height); XSetErrorHandler(X_errors_handler); @@ -501,7 +501,7 @@ msgout (ERROR, "out of memory\n"); end_program(-1); } - + img = imlib_create_image(screen_width, screen_height); imgfinal = imlib_create_image(cfg->texture_size, cfg->texture_size); } @@ -554,7 +554,9 @@ } } - + imlib_free_image(); + imlib_context_set_image(img); + imlib_free_image(); return 0; } @@ -569,25 +571,13 @@ end_program(-1); } - imgfinal = imlib_create_image(cfg->texture_size, cfg->texture_size); + // imgfinal = imlib_create_image(cfg->texture_size, cfg->texture_size); } - - /* set the display , visual, colormap and drawable we are using */ + img = imlib_create_image_from_drawable((Pixmap)0,0,0,screen_width,screen_height,1); + imlib_context_set_image(img); - imlib_copy_drawable_to_image((Pixmap)0, //Pixmap mask, - 0, 0, //int x, int y, - screen_width, //int width, int height, - screen_height, - 0, 0, //int destination_x, int destination_y, - 1 ); //char need_to_grab_x); - - imlib_context_set_image(imgfinal); - imlib_image_clear(); - - imlib_blend_image_onto_image(img, 0, - 0, 0, screen_width, screen_height, - 0, 0, cfg->texture_size, cfg->texture_size); - + imgfinal = imlib_create_cropped_scaled_image(0,0,screen_width,screen_height,cfg->texture_size,cfg->texture_size); + imlib_context_set_image(imgfinal); unsigned int *tmp = imlib_image_get_data(); int w = imlib_image_get_width(); @@ -610,11 +600,13 @@ screenshot_data[offset + 1] = (tmp[img_offset] >> 8) & 0xff; screenshot_data[offset + 2] = tmp[img_offset] & 0xff; screenshot_data[offset + 3] = (tmp[img_offset] >> 24) & 0xff; - - + } } + imlib_free_image(); // saves ~ 10MB of res. Mem @1024x1024 texture_size + imlib_context_set_image(img); + imlib_free_image(); return 0; }