Games-Axmud

 view release on metacpan or  search on metacpan

lib/Games/Axmud/Win/Internal.pm  view on Meta::CPAN

                    );

                } else {

                    $directFlag = $axmud::CLIENT->useDirectKeysFlag;
                }
            }

            # If direct keys are enabled, send certain keycode strings direct to the world
            if ($directFlag && $self->visibleSession) {

                if (
                    (
                        $axmud::CLIENT->ivExists('constDirectAppKeysHash', $string)
                        && (
                            $self->visibleSession->ctrlKeypadMode eq 'alternate'
                            || $self->visibleSession->ctrlCursorMode eq 'application'
                        )
                        && $self->visibleSession->put(
                            $axmud::CLIENT->ivShow('constDirectAppKeysHash', $string),
                        )
                    ) || (
                        $axmud::CLIENT->ivExists('constDirectAltKeysHash', $string)
                        && $self->visibleSession->ctrlKeypadMode eq 'alternate'
                        && $self->visibleSession->put(
                            $axmud::CLIENT->ivShow('constDirectAltKeysHash', $string),
                        )
                    ) || (
                        $axmud::CLIENT->ivExists('constDirectKeysHash', $string)
                        && $self->visibleSession->put(
                            $axmud::CLIENT->ivShow('constDirectKeysHash', $string),
                        )
                    )
                ) {
                    # Return 1 to show that we have interfered with this keypress
                    return 1;

                } elsif (
                    $self->visibleSession->specialEchoMode eq 'enabled'
                    && (! $stripObj || ! $stripObj->specialPreserveFlag)
                    && $axmud::CLIENT->ivExists('constDirectSpecialKeysHash', $string)
                ) {
                    # Warn the entry strip object about a backspace, which should modify a partial
                    #   world command it's been storing
                    if ($stripObj && ! $stripObj->specialPreserveFlag && $string eq 'backspace') {

                        $stripObj->applyBackspace();
                    }

                    if (
                        $self->visibleSession->put(
                            $axmud::CLIENT->ivShow('constDirectSpecialKeysHash', $string),
                        )
                    ) {
                        # Return 1 to show that we have interfered with this keypress
                        return 1;
                    }
                }
            }

            # We don't want to call GA::Session->checkMacros for every keypress (that would be
            #   inefficient)
            # Instead, call it if this is a 'main' window, and if this keycode string is being used
            #   by any macro in any session (not perfectly efficient, but better)
            if (
                $self->visibleSession
                && $axmud::CLIENT->ivExists('activeKeycodeHash', $string)
                && $self->visibleSession->checkMacros($string)
            ) {
                # Return 1 to show that we have interfered with this keypress (by firing a macro)
                return 1;
            }

            # If no macro fired as a result of the keypress, then we can process some special keys

            # The first pane object in the entry strip object's ->paneObjList is the one to which
            #   keypresses are applied
            if ($stripObj) {

                $paneObj = $stripObj->ivFirst('paneObjList');

            } else {

                # If there's no entry, then use the first pane object created in this window
                $paneObj = $self->findTableObj('pane');
            }

            if ($paneObj) {

                # Get the pane's visible tab and the scrollable Gtk3::Textview
                $tabObj = $paneObj->getVisibleTab();
                if ($tabObj) {

                    $splitScreenMode = $tabObj->textViewObj->splitScreenMode;
                    if ($splitScreenMode eq 'split') {
                        $textView = $tabObj->textViewObj->textView2;
                    } else {
                        $textView = $tabObj->textViewObj->textView;
                    }
                }
            }

            # The CTRL+C combination tends to be CTRL+SHIFT+C in Gtk, which is very inconvenient.
            #   Implement a quick-and-dirty CTRL+C instead
            if ($string eq 'ctrl c' && $tabObj) {

                ($startIter, $endIter) = $tabObj->textViewObj->buffer->get_selection_bounds();
                if (defined $endIter) {

                    $slice = $tabObj->textViewObj->buffer->get_slice($startIter, $endIter, FALSE);
                    if (defined $slice && $slice ne '') {

                        $clipboard = Gtk3::Clipboard::get(Gtk3::Gdk::Atom::intern('CLIPBOARD', 0));
                        if ($clipboard) {

                            $clipboard->set_text($slice);

                            # Return 1 to show that we have interfered with this keypress
                            return 1;
                        }
                    }
                }

            # If the page up/page down/home/end keys have been pressed, scroll the vertical
            #   scrollbar containing the textview object
            } elsif (
                (
                    $standard eq 'page_up' || $standard eq 'page_down' || $standard eq 'home'



( run in 1.059 second using v1.01-cache-2.11-cpan-75ffa21a3d4 )