Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » How does UPP classify keys (key abstraction)
How does UPP classify keys [message #54579] Mon, 17 August 2020 07:28 Go to next message
chivstyle is currently offline  chivstyle
Messages: 8
Registered: August 2020
Location: China
Promising Member
Hi,

I'm developing our virtual terminal, but I'm confused about the key abstraction. I've read the manual book, still confused.

I tested these codes below, it worked well so far. Can anyone help me please ?

bool SerialConnVT::Key(dword key, int)
{
    bool processed = false;
    // split key and flags.
	dword flags = K_CTRL | K_ALT | K_SHIFT;
    dword d_key = key & ~(flags | K_KEYUP); // key with delta
    flags = key & flags;
    //
	if (d_key & K_DELTA) { // can't capture RETURN
	    if (key & K_KEYUP) {
	        processed = ProcessKeyUp(d_key, flags);
	    } else {
	        processed = ProcessKeyDown(d_key, flags);
	    }
	} else {
	    if (key < 0xffff) {
	        processed = ProcessChar(d_key);
	        ProcessKeyDown(d_key, flags);
	    } else if (key & K_KEYUP) {
	        // RETURN will reach here
	        ProcessKeyUp(d_key, flags);
	    }
	}
	if (processed) {
	    mScrollToEnd = true;
	}
	return processed;
}
Re: How does UPP classify keys [message #54580 is a reply to message #54579] Mon, 17 August 2020 09:51 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 1092
Registered: August 2007
Senior Contributor
Hello chivstyle,

In short, it is generally better to handle the control keys before stripping the delta on all platforms (MacOS uses "platform independent values" for those keys while windows and linux use ASCII codes, such as 0x0D for K_RETURN. Thus on MacOS, the K_RETURN value is shifted with delta flag, while on Windows and Linux (and others) it is simply ASCII code 0x0d).


P.s. Since you are developing a terminal emulator, there is already a high-end terminal emulator ctrl (widget) for Upp, that can speed up your development. Have you checked it?


Best regards,
Oblivion



[Updated on: Mon, 17 August 2020 09:57]

Report message to a moderator

Re: How does UPP classify keys [message #54582 is a reply to message #54580] Mon, 17 August 2020 10:27 Go to previous messageGo to next message
chivstyle is currently offline  chivstyle
Messages: 8
Registered: August 2020
Location: China
Promising Member
Thanks very much. I've read the VT102's mannual, it taked me lot of time. ECMA48, Xterm, oh, no!

Thanks, you saved me from those heavy documentations.
Re: How does UPP classify keys [message #54584 is a reply to message #54582] Mon, 17 August 2020 11:06 Go to previous message
Oblivion is currently offline  Oblivion
Messages: 1092
Registered: August 2007
Senior Contributor
Happy to help. Smile

Thanks very much. I've read the VT102's mannual, it taked me lot of time. ECMA48, Xterm, oh, no!


Those documents are just the tip of the iceberg. First doc to read should be the DEC STD 070 document (a.k.a "the bible").
But I am afraid if you need a good and "modern" emulation you have to deal with 60 years of incompatible and "insane" cruft, which is a PITA.

By the way, to my knowledge our Terminal ctrl has very high xterm comaptibility with cross-platform support, and implements some of the "coolest" modern features. Smile So it can save your time a lot. (even reading its code might be helpful. Plus, it has a sapearately available "lexical" ANSI/DEC sequence parser that you can use build your own emulator. Plus it comes with example code (SSH/PTY connections, tabbed, splitted interfaces, etc.) (Disclaimer: I am advertising it because I am its author: Very Happy )

If you need any help or have questions on terminal emulation related stuff let me know.


Best regards,
Oblivion.


[Updated on: Mon, 17 August 2020 11:15]

Report message to a moderator

Previous Topic: Linking on OpenIndiana
Next Topic: [Proposition] Simply source package manager for Upp
Goto Forum:
  


Current Time: Thu Apr 25 16:16:03 CEST 2024

Total time taken to generate the page: 0.02124 seconds