Skip to content

font-viewer: Bring the window to the front when triggering the app #780

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cwendling
Copy link
Member

If the app is already open, we need to tell the desktop that the window has been triggered, so it can either bring it to front, or notify the user the window claims attention.

This fixes the cases where the font viewer is already open and gets triggered again, e.g. by opening a font or launching it directly.

If the app is already open, we need to tell the desktop that the window
has been triggered, so it can either bring it to front, or notify the
user the window claims attention.

This fixes the cases where the font viewer is already open and gets
triggered again, e.g. by opening a font or launching it directly.
@cwendling cwendling requested a review from a team May 14, 2025 17:23
@lukefromdc
Copy link
Member

Got a build failure in Meson with an error at the end of this string of test, appears to be unrelated to this PR. The autotools build finished without issue:

/usr/include/libayatana-appindicator3-0.1/libayatana-appindicator/app-indicator.h:262:33: note: declared here
  262 | void                            app_indicator_set_attention_icon (AppIndicator       *self,
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[507/538] Linking target capplets/display/mate-display-properties
FAILED: capplets/display/mate-display-properties 
cc  -o capplets/display/mate-display-properties capplets/display/mate-display-properties.p/meson-generated_.._mate-display-properties-resources.c.o capplets/display/mate-display-properties.p/meson-generated_.._foo-marshal.c.o capplets/display/mate-display-properties.p/xrandr-capplet.c.o capplets/display/mate-display-properties.p/scrollarea.c.o -Wl,--as-needed -Wl,--no-undefined -Wl,--start-group capplets/common/libcommon.a /usr/lib/x86_64-linux-gnu/libgio-2.0.so /usr/lib/x86_64-linux-gnu/libgobject-2.0.so /usr/lib/x86_64-linux-gnu/libglib-2.0.so /usr/lib/x86_64-linux-gnu/libXcursor.so /usr/lib/x86_64-linux-gnu/libX11.so /usr/lib/x86_64-linux-gnu/libmarco-private.so /usr/lib/x86_64-linux-gnu/libgtk-3.so /usr/lib/x86_64-linux-gnu/libgdk-3.so /usr/lib/x86_64-linux-gnu/libz.so /usr/lib/x86_64-linux-gnu/libpangocairo-1.0.so /usr/lib/x86_64-linux-gnu/libpango-1.0.so /usr/lib/x86_64-linux-gnu/libharfbuzz.so /usr/lib/x86_64-linux-gnu/libatk-1.0.so /usr/lib/x86_64-linux-gnu/libcairo-gobject.so /usr/lib/x86_64-linux-gnu/libcairo.so /usr/lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so /usr/lib/x86_64-linux-gnu/libmate-desktop-2.so /usr/lib/x86_64-linux-gnu/libgthread-2.0.so -pthread -lgmodule-2.0 -Wl,--end-group
/usr/bin/ld: capplets/display/mate-display-properties.p/scrollarea.c.o: in function `foo_marshal_VOID__OBJECT_OBJECT':
/home/luke/Desktop/Development/MATE_Development_Work/mate-control-center_1.29.0+git20240627/build/../capplets/display/foo-marshal.h:68: multiple definition of `foo_marshal_VOID__OBJECT_OBJECT'; capplets/display/mate-display-properties.p/meson-generated_.._foo-marshal.c.o:/home/luke/Desktop/Development/MATE_Development_Work/mate-control-center_1.29.0+git20240627/build/capplets/display/foo-marshal.c:60: first defined here
/usr/bin/ld: capplets/display/mate-display-properties.p/scrollarea.c.o: in function `foo_marshal_VOID__UINT_UINT_UINT_UINT':
/home/luke/Desktop/Development/MATE_Development_Work/mate-control-center_1.29.0+git20240627/build/../capplets/display/foo-marshal.h:115: multiple definition of `foo_marshal_VOID__UINT_UINT_UINT_UINT'; capplets/display/mate-display-properties.p/meson-generated_.._foo-marshal.c.o:/home/luke/Desktop/Development/MATE_Development_Work/mate-control-center_1.29.0+git20240627/build/capplets/display/foo-marshal.c:97: first defined here
/usr/bin/ld: capplets/display/mate-display-properties.p/scrollarea.c.o: in function `foo_marshal_VOID__UINT_UINT':
/home/luke/Desktop/Development/MATE_Development_Work/mate-control-center_1.29.0+git20240627/build/../capplets/display/foo-marshal.h:166: multiple definition of `foo_marshal_VOID__UINT_UINT'; capplets/display/mate-display-properties.p/meson-generated_.._foo-marshal.c.o:/home/luke/Desktop/Development/MATE_Development_Work/mate-control-center_1.29.0+git20240627/build/capplets/display/foo-marshal.c:138: first defined here
/usr/bin/ld: capplets/display/mate-display-properties.p/scrollarea.c.o: in function `foo_marshal_VOID__BOXED_BOXED':
/home/luke/Desktop/Development/MATE_Development_Work/mate-control-center_1.29.0+git20240627/build/../capplets/display/foo-marshal.h:213: multiple definition of `foo_marshal_VOID__BOXED_BOXED'; capplets/display/mate-display-properties.p/meson-generated_.._foo-marshal.c.o:/home/luke/Desktop/Development/MATE_Development_Work/mate-control-center_1.29.0+git20240627/build/capplets/display/foo-marshal.c:175: first defined here
/usr/bin/ld: capplets/display/mate-display-properties.p/scrollarea.c.o: in function `foo_marshal_VOID__POINTER_BOXED_POINTER':
/home/luke/Desktop/Development/MATE_Development_Work/mate-control-center_1.29.0+git20240627/build/../capplets/display/foo-marshal.h:260: multiple definition of `foo_marshal_VOID__POINTER_BOXED_POINTER'; capplets/display/mate-display-properties.p/meson-generated_.._foo-marshal.c.o:/home/luke/Desktop/Development/MATE_Development_Work/mate-control-center_1.29.0+git20240627/build/capplets/display/foo-marshal.c:212: first defined here
/usr/bin/ld: capplets/display/mate-display-properties.p/scrollarea.c.o: in function `foo_marshal_VOID__POINTER_POINTER':
/home/luke/Desktop/Development/MATE_Development_Work/mate-control-center_1.29.0+git20240627/build/../capplets/display/foo-marshal.h:309: multiple definition of `foo_marshal_VOID__POINTER_POINTER'; capplets/display/mate-display-properties.p/meson-generated_.._foo-marshal.c.o:/home/luke/Desktop/Development/MATE_Development_Work/mate-control-center_1.29.0+git20240627/build/capplets/display/foo-marshal.c:251: first defined here
collect2: error: ld returned 1 exit status
[520/538] Merging translations for capplets/keybindings/mate-keybinding.desktop
ninja: build stopped: subcommand failed.
luke@ubuntu:~/Desktop/Development/MATE_Development_Work/mate-control-center_1.29.0+git20240627$ 

Copy link
Member

@lukefromdc lukefromdc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works, stopping the odd back button behavior if fonts are clicked on in /usr/share/fonts in caja while the font viewer is open.

Given the file involved, I am all but certain the meson build failure is unrelated to this, the autotools build went fine and I was able to test the new build of mate-font-viewer. Approving

@lukefromdc
Copy link
Member

The travis fails are also unrelated to this PR:


Join over 500,000 developers testing and building on Travis CI

mate-desktop / mate-control-center
build:errored
log scanlog scanfailingfailing

    Current
    Branches
    Build History
    Pull Requests

    Build #1480
    Job #1480.2

font-viewer-present font-viewer: Bring the window to the front when triggering t…

If the app is already open, we need to tell the desktop that the window
has been triggered, so it can either bring it to front, or notify the
user the window claims attention.

This fixes the cases where the font viewer is already open and gets
triggered again, e.g. by opening a font or launching it directly.

Commit cdb9559
Compare cdb955910f70
Branch font-viewer-present

Colomban Wendling avatar Colomban Wendling
#1480.2 errored

Ran for 47 sec

    11 hours ago

AMD64
Shell
Git
DISTRO="fedora:latest"

    Job log
    View config

Raw log

0.00s0.18s0.11s0.06s0.00s
worker_info

Worker information

0.37s0.01s0.00s0.01s
system_info

Build system information

0.02s0.01s1.06s0.25s0.06s0.00s0.03s0.00s0.01s0.01s0.02s0.01s0.01s0.00s0.32sOK

0.00s0.07s0.00s0.02s0.13s0.00s0.00s0.00s0.01s0.00s0.10s0.00s0.88s0.00s0.00s6.04s0.00s3.53s0.00s2.20s
docker_mtu_and_registry_mirrors
Docker
resolvconf
apt

18.81s$ travis_apt_get_update

services

3.02s$ sudo systemctl start docker
git.checkout

0.01s1.66s$ git clone --depth=50 --branch=font-viewer-present https://github.com/mate-desktop/mate-control-center.git mate-desktop/mate-control-center

0.00s

Setting environment variables from .travis.yml

$ export DISTRO="fedora:latest"

$ bash -c 'echo $BASH_VERSION'

5.1.16(1)-release

before_install.1

0.30s$ curl -Ls -o docker-build https://github.com/mate-desktop/mate-dev-scripts/raw/master/travis/docker-build
before_install.2

0.32s$ curl -Ls -o gen-index https://github.com/mate-desktop/mate-dev-scripts/raw/master/travis/gen-index.sh
before_install.3

0.00s$ chmod +x docker-build gen-index
install.1

4.87s$ pip3 install PyGithub

0.13s$ ./docker-build --name ${DISTRO} --config .build.yml --install

Please make sure your .travis.yml has the follow lines:

install:

  - sudo apt-get install -y python3-pip python3-setuptools

  - sudo pip3 install --upgrade pip

  - sudo pip install PyGithub

  - ./docker-build --name ${DISTRO} --config .travis.yml --install

The command "./docker-build --name ${DISTRO} --config .build.yml --install" failed and exited with 1 during .

Your build has been stopped.

@cwendling
Copy link
Member Author

This works, stopping the odd back button behavior if fonts are clicked on in /usr/share/fonts in caja while the font viewer is open.

Wait, this PR has nothing to do with that issue, which is #777 (included here though). What this should fix is that if you open repeated fonts like you say, the font viewer window is brought to front each time.

@lukefromdc
Copy link
Member

lukefromdc commented May 15, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants