--- uae/src/xwin.c 2018/04/24 16:44:42 1.1.1.6 +++ uae/src/xwin.c 2018/04/24 16:51:21 1.1.1.9 @@ -115,6 +115,7 @@ struct disp_info { static Display *display; static int screen; static Window rootwin, mywin; +static Atom delete_win; static GC mygc; static XColor black, white; @@ -170,7 +171,7 @@ static void handle_inhibit (void); static void framerate_up (void); static void framerate_down (void); - +static void handle_interpol (void); static struct uae_hotkeys hotkeys[] = { #ifdef USE_DGA_EXTENSION {{ XK_F12, XK_s, 0 }, handle_modeswitch, -1, 0 }, @@ -179,6 +180,7 @@ static struct uae_hotkeys hotkeys[] = { {{ XK_F12, XK_m, 0 }, togglemouse, -1, 0 }, {{ XK_F12, XK_g, 0 }, handle_mousegrab, -1, 0 }, {{ XK_F12, XK_i, 0 }, handle_inhibit, -1, 0 }, + {{ XK_F12, XK_p, 0 }, handle_interpol, -1, 0 }, {{ XK_F12, XK_KP_Add, 0 }, framerate_up, -1, 0 }, {{ XK_F12, XK_KP_Subtract, 0 }, framerate_down, -1, 0 }, {{ XK_Scroll_Lock, 0 }, handle_inhibit, -1, 0 }, @@ -447,7 +449,7 @@ void flush_screen (int ystart, int ystop #endif } -static __inline__ int bitsInMask (unsigned long mask) +STATIC_INLINE int bitsInMask (unsigned long mask) { /* count bits in mask */ int n = 0; @@ -458,7 +460,7 @@ static __inline__ int bitsInMask (unsign return n; } -static __inline__ int maskShift (unsigned long mask) +STATIC_INLINE int maskShift (unsigned long mask) { /* determine how far mask is shifted */ int n = 0; @@ -717,6 +719,8 @@ static void graphics_subinit (void) { int i, j; XSetWindowAttributes wattr; + XClassHint classhint; + XWMHints *hints; unsigned long valuemask; dgamode = screen_is_picasso ? currprefs.gfx_pfullscreen : currprefs.gfx_afullscreen; @@ -739,11 +743,29 @@ static void graphics_subinit (void) wattr.event_mask = EVENTMASK; XSync (display, 0); + delete_win = XInternAtom(display, "WM_DELETE_WINDOW", False); mywin = XCreateWindow (display, rootwin, 0, 0, current_width, current_height, 0, bitdepth, InputOutput, vis, valuemask, &wattr); + XSetWMProtocols (display, mywin, &delete_win, 1); XSync (display, 0); XStoreName (display, mywin, "UAE"); + XSetIconName (display, mywin, "UAE Screen"); + + /* set class hint */ + classhint.res_name = "UAE"; + classhint.res_class = "UAEScreen"; + XSetClassHint(display, mywin, &classhint); + + hints = XAllocWMHints(); + /* Set window group leader to self to become an application + * that can be hidden by e.g. WindowMaker. + * Would be more useful if we could find out what the + * (optional) GTK+ window ID is :-/ */ + hints->window_group = mywin; + hints->flags = WindowGroupHint; + XSetWMHints(display, mywin, hints); + XMapRaised (display, mywin); XSync (display, 0); mygc = XCreateGC (display, mywin, 0, 0); @@ -1076,7 +1098,11 @@ static int kc_decode (KeySym ks) case XK_Left: return AK_LF; case XK_Right: return AK_RT; +#if 0 case XK_F11: return AK_BACKSLASH; +#else + case XK_F11: frametime = 0; timeframes = 0; bogusframe = 1; break; +#endif #ifdef XK_Page_Up /* These are missing occasionally */ case XK_Page_Up: return AK_RAMI; /* PgUp mapped to right amiga */ case XK_Page_Down: return AK_LAMI; /* PgDn mapped to left amiga */ @@ -1485,6 +1511,11 @@ void handle_events (void) case Expose: refresh_necessary = 1; break; + case ClientMessage: + if (event.xclient.data.l[0]==delete_win) { + uae_quit (); + } + break; } } @@ -1826,16 +1857,37 @@ static void handle_inhibit (void) toggle_inhibit_frame (IHF_SCROLLLOCK); } +#include "gensound.h" +#include "sounddep/sound.h" +#include "events.h" +#include "audio.h" + +static void handle_interpol (void) +{ + if (currprefs.sound_interpol == 0) { + currprefs.sound_interpol = 1; + printf ("Interpol on: rh\n"); + } + else if (currprefs.sound_interpol == 1) { + currprefs.sound_interpol = 2; + printf ("Interpol on: crux\n"); + } + else { + currprefs.sound_interpol = 0; + printf ("Interpol off\n"); + } +} + static void framerate_up (void) { - if (currprefs.framerate < 20) - changed_prefs.framerate = currprefs.framerate + 1; + if (currprefs.gfx_framerate < 20) + changed_prefs.gfx_framerate = currprefs.gfx_framerate + 1; } static void framerate_down (void) { - if (currprefs.framerate > 1) - changed_prefs.framerate = currprefs.framerate - 1; + if (currprefs.gfx_framerate > 1) + changed_prefs.gfx_framerate = currprefs.gfx_framerate - 1; } static void handle_modeswitch (void)