Does anybody know how to simulate press Fn+Scroll Lk in Linux c

Does anybody know how to simulate press Fn+Scroll Lk in Linux c?

Thanks in advance!

How to simulate? as in feed the OS a fake key event? For what purpose? Faking a key event is fairly difficult and means reconfiguring things in advance to allow for it (but not impossible, see matchbox-keyboard). But depending on what you want you may not need to fake a key event, what is it?

Hi Corona688,

I want to press Fn+Scroll Lk in Linux c programming, not manually.

I see the command xvkdb can simulate press key. But I don't know whether it supports

the combination key or not.

Could you please shed some light on me, thank you!

I'm not trying to be obstinate. If I ask a question the first time I'm going to ask it again when ignored because the answer would be genuinely useful.

Nearly all applications filter out that kind of induced key-event for security reasons. This is why faking a usable, 'real' key event is fairly difficult and means reconfiguring things in advance to allow for it (see matchbox-keyboard) -- it means feeding X11 an entire fake keyboard device to generate 'real' events. But depending on what the ultimate goal is you may not need to fake a key event, what is it? What does fn-scroll-lock even mean? most keyboards have no fn-key, and the fn-key is generally not mapped to a real key if it does, instead producing key combinations that could be completely different keys.

Corona is dead-on. What exactly are you trying to do?

We don't need to know how you think it should be done. We've already got that. And it is a bear to code.

Dear Corona688,

I want to use key of Scroll Lk to lock the current screen.
I'm quite new in linux c development. But familiar with windows c, c++ programming.

The context is like this:
I want to migrate the application program of Turbo C in Dos OS to Linux environment.
I think you may be expert in Turbo C program.
One function is to get the status of current screen.(locked or unlocked) and set the current screen to be locked or unlocked.

I don't know how to design this kind of migration. Maybe I should not translate line by line, but use another more sensible method.
Can you give some suggestions on this? Thank you very much!

Unix has ctrl-s - "lock" ctrl-q "unlock" already builtin to consoles.
The tty driver does this for you.

Meaning, the program doesn't have access to that, either. :wink: Terminal scroll locking is not something the program is ever supposed to have control over. Sending data when not requested could mean data loss, so it really doesn't until told.

But at least it will work in a virtual console, unlike the scroll-lock key. The scroll-lock key only works on physical text consoles(which are probably available via ctrl-alt-f1 through ctrl-alt-f6, if you're curious. ctrl-alt-f7 to get back to X11.)

Perhaps your program could do a sort of virtual scroll lock instead. Instead of locking the console, it could just not print?

Hi jim mcnamara,

Do you mean I don't need to realize this function because tty driver has already

provided this.

Thank you!

The TTY driver lets the client lock and unlock. It doesn't let your program lock or unlock.