removed unused textinput event

updated to latest clang-format
This commit is contained in:
Anthony Pesch 2017-04-11 08:54:49 -04:00
parent 9696732537
commit 4c30c2b4e5
18 changed files with 26 additions and 86 deletions

View File

@ -256,16 +256,9 @@ struct emu *emu_create(struct window *window) {
struct emu *emu = calloc(1, sizeof(struct emu));
emu->window = window;
emu->listener = (struct window_listener){emu,
&emu_paint,
&emu_debug_menu,
&emu_joy_add,
&emu_joy_remove,
&emu_keydown,
NULL,
NULL,
&emu_close,
{0}};
emu->listener = (struct window_listener){
emu, &emu_paint, &emu_debug_menu, &emu_joy_add, &emu_joy_remove,
&emu_keydown, NULL, &emu_close, {0}};
win_add_listener(emu->window, &emu->listener);
/* enable debug menu by default */

View File

@ -838,8 +838,8 @@ struct tracer *tracer_create(struct window *window) {
tracer->window = window;
tracer->listener = (struct window_listener){
tracer, &tracer_paint, NULL, NULL, NULL,
&tracer_keydown, NULL, NULL, &tracer_close, {0}};
tracer, &tracer_paint, NULL, NULL, NULL,
&tracer_keydown, NULL, &tracer_close, {0}};
tracer->provider =
(struct texture_provider){tracer, &tracer_texture_provider_find_texture};
tracer->rb = window->rb;

View File

@ -167,16 +167,16 @@ static void aica_timer_expire_2(void *data) {
}
static uint32_t aica_timer_tctl(struct aica *aica, int n) {
return n == 0 ? aica->common_data->TACTL : n == 1 ? aica->common_data->TBCTL
: aica->common_data->TCCTL;
return n == 0 ? aica->common_data->TACTL
: n == 1 ? aica->common_data->TBCTL : aica->common_data->TCCTL;
}
static uint32_t aica_timer_tcnt(struct aica *aica, int n) {
struct timer *timer = aica->timers[n];
if (!timer) {
/* if no timer has been created, return the raw value */
return n == 0 ? aica->common_data->TIMA : n == 1 ? aica->common_data->TIMB
: aica->common_data->TIMC;
return n == 0 ? aica->common_data->TIMA
: n == 1 ? aica->common_data->TIMB : aica->common_data->TIMC;
}
/* else, dynamically compute the value based on the timer's remaining time */

View File

@ -1,8 +1,8 @@
#include <limits.h>
#include "hw/pvr/tr.h"
#include "hw/pvr/trace.h"
#include "core/assert.h"
#include "core/math.h"
#include "hw/pvr/trace.h"
#include "hw/pvr/tr.h"
#include "sys/filesystem.h"
void get_next_trace_filename(char *filename, size_t size) {

View File

@ -1,5 +1,5 @@
#include "hw/sh4/sh4.h"
#include "hw/scheduler.h"
#include "hw/sh4/sh4.h"
static const int64_t PERIPHERAL_CLOCK_FREQ = SH4_CLOCK_FREQ >> 2;
static const int PERIPHERAL_SCALE[] = {2, 4, 6, 8, 10, 0, 0, 0};
@ -84,8 +84,8 @@ static void sh4_tmu_reschedule(struct sh4 *sh4, int n, uint32_t tcnt,
*timer = NULL;
}
timer_cb cb = (n == 0 ? &sh4_tmu_expire_0 : n == 1 ? &sh4_tmu_expire_1
: &sh4_tmu_expire_2);
timer_cb cb = (n == 0 ? &sh4_tmu_expire_0
: n == 1 ? &sh4_tmu_expire_1 : &sh4_tmu_expire_2);
*timer = scheduler_start_timer(sh4->scheduler, cb, sh4, remaining);
}

View File

@ -1,5 +1,5 @@
#include "jit/ir/ir.h"
#include "core/string.h"
#include "jit/ir/ir.h"
enum ir_token {
TOK_EOF,

View File

@ -1,6 +1,6 @@
#include <inttypes.h>
#include "jit/ir/ir.h"
#include "core/string.h"
#include "jit/ir/ir.h"
static void ir_write_type(enum ir_type type, FILE *output) {
switch (type) {

View File

@ -1,7 +1,7 @@
#include <mach/mach.h>
#include <pthread.h>
#include "sys/exception_handler.h"
#include "core/log.h"
#include "sys/exception_handler.h"
/* POSIX signal handlers, for whatever reason, don't seem to be invoked for
segmentation faults on OSX when running the application under lldb / gdb.

View File

@ -2,11 +2,11 @@
#include <sys/mman.h>
#include <sys/stat.h>
#include <unistd.h>
#include "sys/memory.h"
#include "core/assert.h"
#include "core/list.h"
#include "core/string.h"
#include "sys/filesystem.h"
#include "sys/memory.h"
#define MAX_SHMEM 128

View File

@ -1,8 +1,8 @@
#include <errno.h>
#include <pthread.h>
#include <stdlib.h>
#include "sys/thread.h"
#include "core/assert.h"
#include "sys/thread.h"
static void thread_destroy(pthread_t *pthread) {
free(pthread);

View File

@ -1,7 +1,7 @@
#include <stdlib.h>
#include <windows.h>
#include "sys/thread.h"
#include "core/assert.h"
#include "sys/thread.h"
struct thread_wrapper {
thread_fn fn;

View File

@ -1,7 +1,7 @@
#include <mach/mach.h>
#include <mach/mach_time.h>
#include "sys/time.h"
#include "core/assert.h"
#include "sys/time.h"
int64_t time_nanoseconds() {
uint64_t result = mach_absolute_time();

View File

@ -1,6 +1,6 @@
#include <Windows.h>
#include "sys/time.h"
#include "core/assert.h"
#include "sys/time.h"
int64_t time_nanoseconds() {
static double scale = 0.0;

View File

@ -273,8 +273,8 @@ struct microprofile *mp_create(struct window *window) {
calloc(1, sizeof(struct microprofile)));
mp->window = window;
mp->listener = {mp, NULL, NULL, NULL, NULL,
&mp_keydown, NULL, &mp_mousemove, NULL, {}};
mp->listener = {mp, NULL, NULL, NULL, NULL,
&mp_keydown, &mp_mousemove, NULL, {}};
win_add_listener(mp->window, &mp->listener);

View File

@ -43,14 +43,6 @@ static void nk_keydown(void *data, int device_index, enum keycode code,
}
}
static void nk_textinput(void *data, const char *text) {
struct nuklear *nk = data;
nk_glyph glyph;
memcpy(glyph, text, NK_UTF_SIZE);
nk_input_glyph(&nk->ctx, glyph);
}
static void nk_mousemove(void *data, int x, int y) {
struct nuklear *nk = data;
@ -158,8 +150,7 @@ struct nuklear *nk_create(struct window *window) {
struct nuklear *nk = calloc(1, sizeof(struct nuklear));
nk->window = window;
nk->listener = (struct window_listener){
nk, NULL, NULL, NULL, NULL,
&nk_keydown, &nk_textinput, &nk_mousemove, NULL, {0}};
nk, NULL, NULL, NULL, NULL, &nk_keydown, &nk_mousemove, NULL, {0}};
win_add_listener(nk->window, &nk->listener);

View File

@ -207,14 +207,6 @@ static void win_handle_hatdown(struct window *win, int device_index, int hat,
}
}
static void win_handle_textinput(struct window *win, const char *text) {
list_for_each_entry(listener, &win->listeners, struct window_listener, it) {
if (listener->textinput) {
listener->textinput(listener->data, text);
}
}
}
static void win_handle_mousemove(struct window *win, int x, int y) {
list_for_each_entry(listener, &win->listeners, struct window_listener, it) {
if (listener->mousemove) {
@ -780,10 +772,6 @@ static void win_pump_sdl(struct window *win) {
}
} break;
case SDL_TEXTINPUT: {
win_handle_textinput(win, ev.text.text);
} break;
case SDL_MOUSEBUTTONDOWN:
case SDL_MOUSEBUTTONUP: {
enum keycode keycode;
@ -900,16 +888,6 @@ static void win_pump_sdl(struct window *win) {
}
}
void win_enable_text_input(struct window *win, int active) {
win->text_input = active;
if (win->text_input) {
SDL_StartTextInput();
} else {
SDL_StopTextInput();
}
}
void win_enable_debug_menu(struct window *win, int active) {
win->debug_menu = active;
}

View File

@ -26,7 +26,7 @@ struct SDL_Window;
#define NUM_JOYSTICK_KEYS ((K_JOY31 - K_JOY0) + 1)
#define NUM_JOYSTICK_HATS (((K_HAT15 - K_HAT0) + 1) / 4) /* 4 keys per hat */
typedef void* glcontext_t;
typedef void *glcontext_t;
struct window_listener {
void *data;
@ -36,7 +36,6 @@ struct window_listener {
void (*joy_remove)(void *data, int joystick_index);
void (*keydown)(void *data, int device_index, enum keycode code,
int16_t value);
void (*textinput)(void *data, const char *text);
void (*mousemove)(void *data, int x, int y);
void (*close)(void *data);
struct list_node it;
@ -54,7 +53,6 @@ struct window {
int height;
int fullscreen;
int debug_menu;
int text_input;
/* private state */
struct list listeners;
@ -77,6 +75,5 @@ void win_pump_events(struct window *win);
void win_set_status(struct window *win, const char *status);
void win_enable_debug_menu(struct window *win, int active);
void win_enable_text_input(struct window *win, int active);
#endif

View File

@ -52,7 +52,6 @@ struct shader_program {
struct render_backend {
struct window *window;
struct window_listener listener;
glcontext_t ctx;
int debug_wireframe;
@ -532,18 +531,6 @@ static void rb_set_initial_state(struct render_backend *rb) {
rb_set_blend_func(rb, BLEND_NONE, BLEND_NONE);
}
static void rb_debug_menu(void *data, struct nk_context *ctx) {
struct render_backend *rb = data;
nk_layout_row_push(ctx, 50.0f);
if (nk_menu_begin_label(ctx, "RENDER", NK_TEXT_LEFT,
nk_vec2(140.0f, 200.0f))) {
nk_layout_row_dynamic(ctx, DEBUG_MENU_HEIGHT, 1);
nk_checkbox_label(ctx, "wireframe", &rb->debug_wireframe);
nk_menu_end(ctx);
}
}
static struct shader_program *rb_get_ta_program(struct render_backend *rb,
const struct surface *surf) {
int idx = surf->shade;
@ -786,8 +773,6 @@ void rb_destroy(struct render_backend *rb) {
win_gl_destroy_context(rb->window, rb->ctx);
}
win_remove_listener(rb->window, &rb->listener);
free(rb);
}
@ -795,10 +780,6 @@ struct render_backend *rb_create(struct window *window) {
struct render_backend *rb = calloc(1, sizeof(struct render_backend));
rb->window = window;
rb->listener = (struct window_listener){
rb, NULL, &rb_debug_menu, NULL, NULL, NULL, NULL, NULL, NULL, {0}};
win_add_listener(rb->window, &rb->listener);
rb->ctx = win_gl_create_context(rb->window);
if (!rb->ctx) {
rb_destroy(rb);