CtrlCore: X11 key handling improved (thanks Oblivion), ide: patch tool improved

git-svn-id: svn://ultimatepp.org/upp/trunk@15617 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2020-12-22 14:46:15 +00:00
parent acf7cc8ad4
commit 5beff5b389
4 changed files with 42 additions and 31 deletions

View file

@ -221,31 +221,30 @@ void Ctrl::EventProc(XWindow& w, XEvent *event)
dword up = pressed ? 0 : K_KEYUP;
static struct { KeySym keysym; dword key; } tab[] = {
{ XK_ISO_Left_Tab, K_TAB|K_SHIFT },
{ XK_BackSpace, K_BACKSPACE },
{ XK_Tab, K_TAB },
{ XK_Return, K_ENTER },
{ XK_KP_Enter, K_ENTER },
{ XK_Escape, K_ESCAPE },
{ XK_space, K_SPACE },
{ XK_KP_Space, K_SPACE },
{ XK_KP_Tab, K_TAB },
{ XK_KP_Enter, K_ENTER },
{ XK_KP_F1, K_F1 },
{ XK_KP_F2, K_F2 },
{ XK_KP_F3, K_F3 },
{ XK_KP_F4, K_F4 },
{ XK_KP_Home, K_HOME },
{ XK_KP_Left, K_LEFT },
{ XK_KP_Up, K_UP },
{ XK_KP_Right, K_RIGHT },
{ XK_KP_Down, K_DOWN },
{ XK_KP_Page_Up, K_PAGEUP },
{ XK_KP_Page_Down, K_PAGEDOWN },
{ XK_KP_End, K_END },
{ XK_KP_Begin, K_HOME },
{ XK_KP_Insert, K_INSERT },
{ XK_KP_Delete, K_DELETE },
{ XK_BackSpace, K_BACKSPACE },
{ XK_Tab, K_TAB },
{ XK_Return, K_ENTER },
{ XK_KP_Enter, K_ENTER },
{ XK_Escape, K_ESCAPE },
{ XK_space, K_SPACE },
{ XK_KP_Space, K_SPACE },
{ XK_KP_Tab, K_TAB },
{ XK_KP_Enter, K_ENTER },
{ XK_KP_F1, K_F1 },
{ XK_KP_F2, K_F2 },
{ XK_KP_F3, K_F3 },
{ XK_KP_F4, K_F4 },
{ XK_KP_Home, K_HOME },
{ XK_KP_Left, K_LEFT },
{ XK_KP_Up, K_UP },
{ XK_KP_Right, K_RIGHT },
{ XK_KP_Down, K_DOWN },
{ XK_KP_Page_Up, K_PAGEUP },
{ XK_KP_Page_Down, K_PAGEDOWN },
{ XK_KP_End, K_END },
{ XK_KP_Begin, K_HOME },
{ XK_KP_Insert, K_INSERT },
{ XK_KP_Delete, K_DELETE },
};
for(int i = 0; i < __countof(tab); i++)
if(tab[i].keysym == keysym) {
@ -262,9 +261,17 @@ void Ctrl::EventProc(XWindow& w, XEvent *event)
}
#ifndef PLATFORM_OSX11
if(GetCtrl() || GetAlt()) { // fix Ctrl+Shift+1 etc...
keysym = decode((int)event->xkey.keycode, 0xa, '1', 0xb, '2', 0xc, '3', 0xd, '4',
0xe, '5', 0xf, '6', 0x10, '7', 0x11, '8', 0x12, '9', 0x13, '0',
keysym);
keysym = decode((int)event->xkey.keycode,
0x0a, 0x31,
0x0b, 0x32,
0x0c, 0x33,
0x0d, 0x34,
0x0e, 0x35,
0x0f, 0x36,
0x10, 0x37,
0x11, 0x38,
0x12, 0x39,
0x13, 0x30, keysym);
}
#endif
// DLOG("keysym: " << keysym << " " << (char)keysym);

View file

@ -96,6 +96,7 @@ bool PatchDiff::Open(const char *patch_path, const Vector<String>& target_dirs0)
}
patch_file <<= patch_path;
if(!patch.MatchFiles(target_dirs, pi)) {
Exclamation("Unable to match the directory structure!");
@ -124,8 +125,8 @@ bool PatchDiff::Open(const char *patch_path, const Vector<String>& target_dirs0)
}
failed.Show(failed_count);
failed.SetInk(SRed()).SetFont(StdFont().Bold().Italic());
failed = String() << failed_count << " file(s) cannot be patched";
failed.SetInk(SRed());
failed = String() << failed_count << " file(s) failed";
ShowResult();

View file

@ -117,7 +117,7 @@ bool Patch::MatchFiles(const Vector<String>& dir, Progress& pi)
com_path.Replace("\\", "/");
if(dir.GetCount())
for(int pass = 0; pass < 2; pass++) {
while(com_path.GetCount()) {
for(;;) {
for(String d : dir) {
while(d.GetCount() > 3) {
if(pi.StepCanceled())

View file

@ -569,6 +569,9 @@ void Ide::DoPatchDiff()
Vector<String> d = GetUppDirs();
for(int i = 0; i < d.GetCount(); i++)
dir.FindAdd(d[i]);
const Workspace& wspc = IdeWorkspace();
for(int i = 0; i < wspc.GetCount(); i++)
dir.FindAdd(GetFileFolder(PackagePath(wspc[i])));
static PatchDiff dlg;
dlg.diff.WhenLeftLine = THISBACK1(GotoDirDiffLeft, &dlg);
if(!dlg.IsOpen()) {