Bug 697634

Summary: glfwSetWindowTitle and identifying X11 window
Product: MuPDF Reporter: tuncerayaz
Component: appsAssignee: MuPDF bugs <mupdf-bugs>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P4    
Version: master   
Hardware: PC   
OS: Linux   
Customer: Word Size: ---
Attachments: [PATCH] gl: use fix title for X11 class and instance
[PATCH] gl: use fix title for X11 class and instance

Description tuncerayaz 2017-03-01 16:12:23 UTC
Since glfwSetWindowTitle in X11 context seems to set class, title, and instance to the same string, and given that the title will be the filename followed by the page number, it's impossible to match any of the three X11 window properties for applying a rule. Also, GLFW doesn't seem to provide platform specific APIs that would allow one to set the X11 window class to a different string than the dynamic title.

One possible solution would be to always prefix it with the default/initial title "MuPDF/GL". This could work with matchers able to check for a substring or prefix, but will fail with those that do a whole string match. If we were to implement this, what should the length > 50 case in update_title() do?

Another solution would be to implement a flag to not update the title at all, which if it's deemed fine to include, is easier to implement.
Comment 1 tuncerayaz 2017-03-01 21:20:10 UTC
Actually, there's a bug in gl-main.c where filename is used as the title when creating the window and not "MuPDF/GL". I'll upload a patch to fix that.
Comment 2 tuncerayaz 2017-03-01 21:22:27 UTC
Created attachment 13446 [details]
[PATCH] gl: use fix title for X11 class and instance
Comment 3 tuncerayaz 2017-03-04 15:02:03 UTC
Created attachment 13456 [details]
[PATCH] gl: use fix title for X11 class and instance