More responsive mouse

master
bzt 2019-12-11 11:12:10 +01:00
parent f7fe82f2d4
commit 56cc20d465
6 changed files with 16 additions and 9 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -76,7 +76,8 @@ install: $(TARGET)
install -m 755 -g bin $(TARGET) /usr/bin
@mkdir -p /usr/share/mtsedit
cp ../data/* /usr/share/mtsedit
cp -r ../mt-mod/mtsedit ~/.minetest/mods
cp ../etc/mtsedit.desktop /usr/share/applications
cp ../etc/mtsedit.png /usr/share/icons/hicolor/32x32/apps
package:
ifeq ("$(PACKAGE)","Linux")
@ -93,15 +94,15 @@ ifeq ("$(PACKAGE)","Win")
@cp $(TARGET).exe MTSEdit/$(TARGET).exe
@cp $(MINGWSDL)/i686-w64-mingw32/bin/SDL2.dll MTSEdit/SDL2.dll
@cp -r ../data MTSEdit/data
zip ../$(TARGET)-i686-win.zip MTSEdit
zip -r ../$(TARGET)-i686-win.zip MTSEdit
@rm -rf MTSEdit
else
@mkdir MTSEdit.app MTSEdit.app/Contents MTSEdit.app/Contents/MacOS MTSEdit.app/Contents/Resources
@cp $(TARGET) MTSEdir.app/Contents/MacOS
@cp ../etc/Info.list MTSEdit.app/Contents
@cp $(TARGET) MTSEdit.app/Contents/MacOS
@cp ../etc/Info.plist MTSEdit.app/Contents
@cp ../etc/mtsedit.icns MTSEdit.app/Contents/Resources
@cp -r ../data MTSEdit.app/Contents/Resources
zip ../$(TARGET)-intel-macosx.zip MTSEdit
zip -r ../$(TARGET)-intel-macosx.zip MTSEdit.app
@rm -rf MTSEdit.app
endif
endif

View File

@ -417,9 +417,7 @@ void edit_key(SDL_Event *event)
case SDLK_PERIOD: edit_zoomin(); break;
case SDLK_BACKSPACE:
case SDLK_DELETE:
case SDLK_SPACE:
brush_place(event->key.keysym.sym == SDLK_SPACE && !shift ? palette[activeblock] : 0);
break;
case SDLK_SPACE: brush_place(event->key.keysym.sym == SDLK_SPACE && !shift ? palette[activeblock] : 0); break;
case SDLK_RETURN: brush_floodfill(!shift ? palette[activeblock] : 0); break;
case SDLK_z: hist_undo(); break;
case SDLK_y: hist_redo(); break;

View File

@ -341,7 +341,7 @@ int sdlmain(int opt)
unsigned char *icondata;
char *fn, *title;
int iw = 0, ih = 0, len, i, j, k, l;
SDL_Event event;
SDL_Event event, lookahead;
/* this is tricky, because extern wouldn't know sizeof() */
if(opt) return instmod(binary_mtsedit, sizeof(binary_mtsedit));
@ -413,6 +413,14 @@ int sdlmain(int opt)
/* main loop */
while (!quitting) {
if (SDL_WaitEvent(&event)) {
/* check if we have multiple mouse motion events in the queue, only serve the last */
if(event.type == SDL_MOUSEMOTION) {
lookahead.type = 0;
while(SDL_PollEvent(&lookahead) && lookahead.type == SDL_MOUSEMOTION)
memcpy(&event, &lookahead, sizeof(SDL_Event));
if(lookahead.type && lookahead.type != SDL_MOUSEMOTION)
SDL_PushEvent(&lookahead);
}
switch (event.type) {
/* window events */
case SDL_QUIT: quitting = 1; break;