<commit_before>#include	"compiler.h"
#include	"inputmng.h"
#include	"taskmng.h"
#include	"kbtrans.h"
#include	"vramhdl.h"
#include	"menubase.h"
#include	"sysmenu.h"
#include	"mousemng.h"

#if defined(__LIBRETRO__)
#include <retro_miscellaneous.h>
#include <retro_timers.h>
#include "libretro.h"

extern retro_environment_t environ_cb;
#endif	/* __LIBRETRO__ */

	BOOL	task_avail;


void sighandler(int signo) {

	(void)signo;
	task_avail = FALSE;
}


void taskmng_initialize(void) {

	task_avail = TRUE;
}

void taskmng_exit(void) {

	task_avail = FALSE;
}

#if defined(GCW0)

int ENABLE_MOUSE=0; //0--disable

int convertKeyMap(int scancode){
  switch(scancode){
    case 82: //up
      return SDL_SCANCODE_UP;
    case 81: //down
      return SDL_SCANCODE_DOWN;
    case 80: //left
      return SDL_SCANCODE_LEFT;
    case 79: //right
      return SDL_SCANCODE_RIGHT;
    case 225: //x
      return SDL_SCANCODE_UNKNOWN;
    case 44:  //y
      return SDL_SCANCODE_UNKNOWN;
    case 224: //A
      return  SDL_SCANCODE_RETURN;
    case 226: //B
      return SDLK_TAB;
    case 41: //select
      return SDL_SCANCODE_ESCAPE;
    case 40: //start
      return SDL_SCANCODE_RETURN;
    case 43: //L
      return SDL_SCANCODE_F11;
    case 42: //R
      // ENABLE_MOUSE++;
      // ENABLE_MOUSE=ENABLE_MOUSE%2;
      return 	999;
  }
}

#endif //GCW0

static int lmx = 320, lmy = 240;
void taskmng_rol(void) {

#if !defined(__LIBRETRO__)
	SDL_Event	e;


	if ((!task_avail) || (!SDL_PollEvent(&e))) {
		return;
	}
	switch(e.type) {
		case SDL_MOUSEMOTION:
			if (menuvram == NULL) {
				mousemng_onmove(&e.motion);
			}
			else {
				menubase_moving(e.motion.x, e.motion.y, 0);
				lmx = e.motion.x;
				lmy = e.motion.y;
			}
			break;

		case SDL_MOUSEBUTTONUP:
			switch(e.button.button) {
				case SDL_BUTTON_LEFT:
					if (menuvram != NULL)
					{
						menubase_moving(lmx, lmy, 2);
					}
#if defined(__IPHONEOS__)
					else if (SDL_IsTextInputActive())
					{

						SDL_StopTextInput();
					}
					else if (e.button.y >= 320)
					{
						SDL_StartTextInput();
					}
#endif
					else
					{
						mousemng_buttonevent(&e.button);
					}
					break;

				case SDL_BUTTON_RIGHT:
					if (menuvram == NULL) {
						mousemng_buttonevent(&e.button);
					}
					break;
			}
			break;

		case SDL_MOUSEBUTTONDOWN:
			switch(e.button.button) {
				case SDL_BUTTON_LEFT:
					if (menuvram != NULL)
					{
						menubase_moving(e.button.x, e.button.y, 1);
					} else {
						mousemng_buttonevent(&e.button);
					}
					break;

				case SDL_BUTTON_RIGHT:
					if (menuvram == NULL) {
						mousemng_buttonevent(&e.button);
					}
					break;

				case SDL_BUTTON_MIDDLE:<commit_msg>[SDL2] fix mouse locate 2<commit_after>#include	"compiler.h"
#include	"inputmng.h"
#include	"taskmng.h"
#include	"kbtrans.h"
#include	"vramhdl.h"
#include	"menubase.h"
#include	"sysmenu.h"
#include	"mousemng.h"

#if defined(__LIBRETRO__)
#include <retro_miscellaneous.h>
#include <retro_timers.h>
#include "libretro.h"

extern retro_environment_t environ_cb;
#endif	/* __LIBRETRO__ */

	BOOL	task_avail;


void sighandler(int signo) {

	(void)signo;
	task_avail = FALSE;
}


void taskmng_initialize(void) {

	task_avail = TRUE;
}

void taskmng_exit(void) {

	task_avail = FALSE;
}

#if defined(GCW0)

int ENABLE_MOUSE=0; //0--disable

int convertKeyMap(int scancode){
  switch(scancode){
    case 82: //up
      return SDL_SCANCODE_UP;
    case 81: //down
      return SDL_SCANCODE_DOWN;
    case 80: //left
      return SDL_SCANCODE_LEFT;
    case 79: //right
      return SDL_SCANCODE_RIGHT;
    case 225: //x
      return SDL_SCANCODE_UNKNOWN;
    case 44:  //y
      return SDL_SCANCODE_UNKNOWN;
    case 224: //A
      return  SDL_SCANCODE_RETURN;
    case 226: //B
      return SDLK_TAB;
    case 41: //select
      return SDL_SCANCODE_ESCAPE;
    case 40: //start
      return SDL_SCANCODE_RETURN;
    case 43: //L
      return SDL_SCANCODE_F11;
    case 42: //R
      // ENABLE_MOUSE++;
      // ENABLE_MOUSE=ENABLE_MOUSE%2;
      return 	999;
  }
}

#endif //GCW0

static int lmx = 320, lmy = 240;
void taskmng_rol(void) {

#if !defined(__LIBRETRO__)
	SDL_Event	e;


	if ((!task_avail) || (!SDL_PollEvent(&e))) {
		return;
	}
	switch(e.type) {
		case SDL_MOUSEMOTION:
			if (menuvram == NULL) {
				mousemng_onmove(&e.motion);
			}
			else {
				menubase_moving(e.motion.x, e.motion.y, 0);
				lmx = e.motion.x;
				lmy = e.motion.y;
			}
			break;

		case SDL_MOUSEBUTTONUP:
			switch(e.button.button) {
				case SDL_BUTTON_LEFT:
					if (menuvram != NULL)
					{
						menubase_moving(lmx, lmy, 2);
					}
#if defined(__IPHONEOS__)
					else if (SDL_IsTextInputActive())
					{

						SDL_StopTextInput();
					}
					else if (e.button.y >= 320)
					{
						SDL_StartTextInput();
					}
#endif
					else
					{
						mousemng_buttonevent(&e.button);
					}
					break;

				case SDL_BUTTON_RIGHT:
					if (menuvram == NULL) {
						mousemng_buttonevent(&e.button);
					}
					break;
			}
			break;

		case SDL_MOUSEBUTTONDOWN:
			switch(e.button.button) {
				case SDL_BUTTON_LEFT:
					if (menuvram != NULL)
					{
						menubase_moving(lmx, lmy, 1);
					} else {
						mousemng_buttonevent(&e.button);
					}
					break;

				case SDL_BUTTON_RIGHT:
					if (menuvram == NULL) {
						mousemng_buttonevent(&e.button);
					}
					break;

				case SDL_BUTTON_MIDDLE:
{'fraction_non_alphanumeric': 0.12234240954867587, 'fraction_numerical': 0.01864975755315181, 'mean_word_length': 2.6114478114478112, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '176945', 'n_tokens_mistral': 2672, 'n_tokens_neox': 2172, 'n_words': 417}