• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC SKILL
  3. disabling mouse and keyboard input when calling the system...

Stats

  • Replies 5
  • Subscribers 146
  • Views 219
  • Members are here 0

disabling mouse and keyboard input when calling the system() function

JJ202502261359
JJ202502261359 3 days ago

When a long‑running task such as system("sleep 10") is invoked,
mouse and keyboard events are placed into the input queue.

Consequently, during the 10‑second “sleep”, if you arbitrarily click on the pending layout screen and press the Del key,
the selected object are removed after the 10 seconds have elapsed.

hiSetCursor(getCurrentWindow(), hicHourglass1) system("sleep 10")

the mouse cursor changes, but mouse and keyboard inputs are still accumulated in the queue.
Moreover, this behavior occurs only for certain windows.

Question: How can mouse and keyboard input be disabled for all windows during the execution of system("sleep 10")?

  • Cancel
  • Sign in to reply
Parents
  • Aurel B
    Aurel B 2 days ago

    Hi,

    I made a brutal solution that might work for you (it is far from perfect) : 

    This will unmap/remap the windows while the command runs.

    It should prevent clicking and keyboard inputs (I haven't tested it thoroughly though...)

    It might be surprising for the users that might think Virtuoso has crashed!

    Keeping the CIW mapped or displaying a popup while the command is running might be options to consider.

    (defun blocking_subprocess ( cmd )
      "Run CMD while preventing inputs (keyboard or mouse) to be intercepted by Virtuoso."
      (let ( ( mapped_windows (setof win (hiGetWindowList) (eq 'mapped (hiGetWindowState win))) )
             ( pid            (ipcBeginProcess cmd) )
             )
        (unwindProtect
          (progn (foreach win mapped_windows (hiUnmapWindow win))
                 (ipcWait pid)
                 )
          (foreach win mapped_windows (hiMapWindow win))
          )
        ))

    Another solution that might appear less intrusive is to unmap/remap all the mouse and keyboard shortcuts while the command is running.

    This has to be made very carefully as removing all the shortcuts could be very inconvenient...

    Maybe there is a native solution that I am unaware of and Andrew might know.

    (I tried to ask your question to the support AI assistant but it told me to create a support case Sweat smile)

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Andrew Beckett
    Andrew Beckett 2 days ago in reply to Aurel B

    I'm not aware of any way of doing this. I don't think it's generally something applications can do - I believe it's X windows that takes care of handling the event interaction with applications, so unmapping the windows is probably the only option. 

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • JJ202502261359
    JJ202502261359 2 days ago in reply to Andrew Beckett

    thank you, aurel and andrew.

    when these codes are executed, the window disappears, which makes the usability poor.

    what i'm curious about is that when hiDisplayAppDBox() runs, a modal dialog is shown
    and mouse/keyboard input is blocked at that moment.

    i suspect that inside hiDisplayAppDBox() there is a routine that disables input
    before the modal dialog is displayed.

    how does virtuoso block keyboard and mouse input when hiDisplayAppDBox() is executed?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Aurel B
    Aurel B 1 day ago in reply to JJ202502261359

    It's funny you say that because that was my first attempt and reference.

    However I could not make it work the first time : 

    (defun blocking_subprocess ( cmd )
      "Run CMD while preventing inputs (keyboard or mouse) to be intercepted by Virtuoso."
      (let ( ( name (gensym 'blocking_dbox) )
             ( pid  (ipcBeginProcess cmd)   )
             )
        (setf blocking_subprocess.pid pid)
        (hiEnqueueCmd (lsprintf "{hiFlush() ipcWait(blocking_subprocess.pid) hiDBoxOK(%s)}" name))
        ;(hiRegTimer   (lsprintf "{hiFlush() ipcWait(blocking_subprocess.pid) hiDBoxOK(%s)}" name) 10)
        (hiDisplayAppDBox
          ?name        name
          ?dboxBanner  "tmp block"
          ?dboxText    "Blocking inputs why waiting for subprocess to finish..."
          ?dialogStyle 'modal
          )
        ))

    It seems that even when a modal popup is displayed, when Virtuoso enters ipcWait then all the inputs are catched anyway.

    Which is why I made a second attempt where instead of using ipcWait and then closing the popup. I now have a modal popup that [almost] always repop until the job finishes and kills it. I also added a safeguard so that a user can close it a few times and then regains control over Virtuoso. Which might be before the end of the job (so probably not what you want).

    (defun blocking_subprocess ( cmd )
      "Run CMD while preventing inputs (keyboard or mouse) to be intercepted by Virtuoso."
      (letseq ( ( name  (gensym 'blocking_dbox) )
                ( fnil  (lambda (@rest _) nil) )
                ( pid   (ipcBeginProcess cmd "" fnil fnil
                          ;; Handler to close any remaining popup
                          (lambda (@rest _)
                            (hiEnqueueCmd (lsprintf "(errset (muffleWarnings (hiDBoxOK %s)))" name)))) )
                ( num   5 )
                )
        (ipcWaitForProcess pid)
    (while (and (ipcIsAliveProcess pid) (plusp num)) (hiDisplayAppDBox ?name name ?buttonLayout 'Close ?dialogStyle 'modal ?dboxBanner "Waiting for subprocess..." ?dboxText (lsprintf "This popup prevents inputs while waiting for subprocess to terminate.\n\ It will close automatically.\n\ \n\ (This popup will re-open %d times.)" num--) )) ))

    Anyway, I hope this helps and at least gives you ideas about what you can do.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • Aurel B
    Aurel B 1 day ago in reply to JJ202502261359

    It's funny you say that because that was my first attempt and reference.

    However I could not make it work the first time : 

    (defun blocking_subprocess ( cmd )
      "Run CMD while preventing inputs (keyboard or mouse) to be intercepted by Virtuoso."
      (let ( ( name (gensym 'blocking_dbox) )
             ( pid  (ipcBeginProcess cmd)   )
             )
        (setf blocking_subprocess.pid pid)
        (hiEnqueueCmd (lsprintf "{hiFlush() ipcWait(blocking_subprocess.pid) hiDBoxOK(%s)}" name))
        ;(hiRegTimer   (lsprintf "{hiFlush() ipcWait(blocking_subprocess.pid) hiDBoxOK(%s)}" name) 10)
        (hiDisplayAppDBox
          ?name        name
          ?dboxBanner  "tmp block"
          ?dboxText    "Blocking inputs why waiting for subprocess to finish..."
          ?dialogStyle 'modal
          )
        ))

    It seems that even when a modal popup is displayed, when Virtuoso enters ipcWait then all the inputs are catched anyway.

    Which is why I made a second attempt where instead of using ipcWait and then closing the popup. I now have a modal popup that [almost] always repop until the job finishes and kills it. I also added a safeguard so that a user can close it a few times and then regains control over Virtuoso. Which might be before the end of the job (so probably not what you want).

    (defun blocking_subprocess ( cmd )
      "Run CMD while preventing inputs (keyboard or mouse) to be intercepted by Virtuoso."
      (letseq ( ( name  (gensym 'blocking_dbox) )
                ( fnil  (lambda (@rest _) nil) )
                ( pid   (ipcBeginProcess cmd "" fnil fnil
                          ;; Handler to close any remaining popup
                          (lambda (@rest _)
                            (hiEnqueueCmd (lsprintf "(errset (muffleWarnings (hiDBoxOK %s)))" name)))) )
                ( num   5 )
                )
        (ipcWaitForProcess pid)
    (while (and (ipcIsAliveProcess pid) (plusp num)) (hiDisplayAppDBox ?name name ?buttonLayout 'Close ?dialogStyle 'modal ?dboxBanner "Waiting for subprocess..." ?dboxText (lsprintf "This popup prevents inputs while waiting for subprocess to terminate.\n\ It will close automatically.\n\ \n\ (This popup will re-open %d times.)" num--) )) ))

    Anyway, I hope this helps and at least gives you ideas about what you can do.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
  • JJ202502261359
    JJ202502261359 1 day ago in reply to Aurel B

    thank you for your deep interest.

    we coded the parts that were difficult to implement in skill to Python.
    however, there's a risk that the designer's clicks will be exposed to the virtuoso GUI.
    if Python execution time exceeds 10 seconds, the designer can click the GUI indiscriminately.

    i believe there is an internal function in virtuoso that can disable(keyboard, mouse) a window.
    but there is no way to know.

    i found a way to force it.

    1. process execute

    ipcBeginProcess "python test.py"

    2. simple message box

    a window named 'a' is created, and virtuoso stably blocks keyboard and clicks.

    hiDisplayAppDBox(?name 'a)

    3. in test.py

    a short sleep for window 'a' to be created.

    subprocess this:

    this command line hides the "a" window.
    this makes the "a" message box in Virtuoso invisible, but still protects against keyboard and clicks.

    gdbus call --session \
      --dest org.gnome.Shell \
      --object-path /org/gnome/Shell \
      --method org.gnome.Shell.Eval " \
      const actors = global.get_window_actors(); \
      let target = null; \
      let actor  = null; \
      for (let i = 0; i < actors.length; i++) { \
          const title = actors[i].meta_window.get_title(); \
          if (title === 'a') { \
              target = actors[i].meta_window; \
              actor  = actors[i]; \
              break; \
          } \
      } \
      if (target) { \
          actor.hide() \
          true; \
      } else { \
          false; \
      } \
    "
    when the python code ends, force close the "a" window by executing the following.
    now virtuoso accepts keyboard input and clicks.
    gdbus call --session \
      --dest org.gnome.Shell \
      --object-path /org/gnome/Shell \
      --method org.gnome.Shell.Eval " \
      const actors = global.get_window_actors(); \
      let target = null; \
      for (let i = 0; i < actors.length; i++) { \
          const title = actors[i].meta_window.get_title(); \
          if (title === 'a') { \
              target = actors[i].meta_window; \
              break; \
          } \
      } \
      if (target) { \
          target.delete(global.get_current_time()); \
          true; \
      } else { \
          false; \
      } \
    "

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information