I am writing a C/GTK+ application and this should be targeted for both Linux and Windows.
I have encountered a problem when I open the website link in the about dialog: the expected behaviour would be the browser to open and show the relative webpage (and this works correctly on Linux), but right after clicking on it a popup comes up displaying "It's impossible to show the link because no application to handle it is installed" (roughly translated, I don't see it in english, but in my native language).
How could I fix this? I thought to set a specific handler for the link only for Windows, but I don't know how to get the "link" object in the about dialog. The only thing I found in the documentation is gtk_about_dialog_get_website_label, but it returns a string, so I don't think the handler would work.
When the website label is clicked in a GtkAboutDialog object, the default behavior is to invoke gtk_show_uri. The latter uses GIO to handle the uri itself, which only handles local files. If you want to handle urls (http[s]://, or ftp[s]:// and such), you'll have to install gvfs.
An alternative approach is to connect a callback to the activate-link signal which is emitted when a uri is activated. You can then handle the event, and work some magic depending on what system your application is running on.
The links from my comment that back my claims up (and are useful references in general) are:
GtkAboutDialog and its signals
gtk_show_uri and other file-system goodies
Related
I use Apache2’s mod-autoindex to build a directory listing of files in a folder and MS Edge to display the list. When I click on a .mp4 file, Edge opens a video player embedded in the browser and correctly plays the video. When I click on a .ts file, Edge again opens the embedded player, but nothing plays. I have installed the MPEG-2 Video Extension app from the MS Store and Windows’ built-in Movies and TV app now successfully plays both .mp4 and .ts files when I select them from within Windows Explorer. But Edge still can’t play the .ts file.
The html generated when I click the .ts file includes the element <source src="https://my.site/foldername/filename.ts" type="video/mp2t">
I conclude that whatever player is invoked by Edge doesn’t know how to deal with the video/mp2t file type.
Can anyone help me find a way to either (1) change the way Apache2 generates the html to specify type="video/.ts" or (2) cause the file click to invoke an external player such as Windows’ Movies and TV app rather than Edge’s embedded player?
You just can't play .ts video file in Edge because it's not supported by Edge. From this doc, you can see that only Safari supports MPEG-2. Besides, MPEG-2 Video Extension can only help play MPEG videos in video apps, not Edge.
For your questions:
video/mp2t is the right MIME type for .ts file. You can't change it to video/.ts which is wrong and useless.
You can't open the default media player without downloading the file. So I think it's impossible.
Since my OP in August, I discovered and implemented a somewhat complex, but perfectly functional way to do what I wanted to do. Herewith, a summary of what I did:
Tiring of the limitations of Apache2’s mod_autoindex, I developed my own custom index.php to replace it. Once I had full control over the format and content of the index, I discovered this SO thread wherein #Jun Hsieh provides a detailed discussion of this former MSDN link, which describes the process for Registering an Application to a URI Scheme.
I followed those instructions to create a custom URI handler that will invoke a DOS batch script on my client. Then I coded my index.php to create an HTML anchor with an HREF that invokes my custom URI, including the path to the desired file. When the link is clicked, the browser invokes the URI handler, which invokes the DOS batch script, which validates the file name and proceeds to invoke Microsoft’s MediaPlayer, which includes a codec that can play a network-resident Transport Stream (.ts) file directly, without requiring it to be fully downloaded to the client. The MediaPlayer also has user controls superior to those available in the video player embedded in the Edge browser.
Of course, the custom URI handler is not limited to invoking Microsoft's MediaPlayer and could invoke any app installed on my client PC.
Note that the browser (in this case Edge) will percent-encode the file name passed to the URI handler (i.e. spaces are converted to %20, etc.) so file/folder names that include ‘special’ characters (such as almost every non-letter/number) must be decoded upon receipt to remove the encoding before passing them to the desired app. File/folder names that include characters such as semi-colon, single-quote, and similar characters (perfectly legal in Windows file names) are particularly problematic and must be appropriately handled by the app invoked by the custom URI handler.
Of course, my solution works only on a Windows client, which is OK for me now because I currently do not have any Linux clients on my home network. But believe that it may be possible to create custom handlers on Linux clients as described in this post.
Yes, I’m aware of the potential security risks of this implementation. But my web server serves only the local network within my home. And it now allows me to use a browser as the single UI to browse and stream web content as well as local content. Just what I had been trying to do. Perhaps others will find this information of interest.
is there any way to receive a notification that a new image was loaded into a desired task?
i know that in user mode I can use
_dyld_register_func_for_add_image
but is there any way to do that from kernel?
I know that it seems pretty impossible since dyld is responsible for all the loading process and it's all in the user space.
but maybe someone ever done that before?
This tutorial provides an example of how to detect dyld load events; see the "Monitor Dylib Loading Event" section. It does so using a Mandatory Access Control Framework (MACF) kext to inspect mpo_file_check_mmap events.
It's not the most friendly or complete tutorial about MACF, so you might want to read this MACF tutorial first if you're new to MACF.
In my App I have an annoying behavior. It is causing problems to my costumers.
The app has several points where I need to show a Dialog (Modal), then the users can fill some fields and then they can close the dialog. So the system follows its natural path.
In determined moments this works fine. The dialog is shown, user interacts with it, closes it , ....
But, in others moments (the same code) the dialog doesn't appear automatically. The user needs to execute some external action on device (like change its orientation, touch in the center of the screen, execute scroll gesture, etc). Some action that isn't intuitive at the moment.
This behavior makes the user think my app froze.
For me it is clear that the dialog was called, simply it wasn't drawed on the screen.
I tryed read about this problem.I did some researches in similar questions without success.
I guess the cause is related to EDT.
In short, How can I call a Dialog Modal without breaking EDT-rules.
And more specifically, How can I resolve this problem.
when I request a dialog to be displayed on the screen, I want it really appears in 100% of cases. Today works randomly.
Additional infomations:
My app uses Java 5 yet.
Do you recommends migration to Java 8?
======= Additional Informations (1) ===========
This problem is strongly dependent of device model.
In MotoG3 (Android 6) this problem is a exception. Rarely it occurs.
In my Galaxy Note 8 is the opposite. Always occurs.
In Lenovo Vibe5 (Android 6). Frequently occurs.
I added these informations. Maybe it help to compound problem picture.
Additional question:
Is it possible write a snippet that I can use as a template
to execute Dialog Modal call without break some rule of EDT?
Turn on the EDT violation detection tool in the simulator which should detect such issues. Inspect potentially problematic cases of Dialog calls and post them specifically if you don't know how to fix them.
Java 8 is unrelated although migrating a project is non-trivial.
I am working at an OS independent file manager (using SDL). I am trying to use native functions as much as possible (with the appropriate #ifdefs), and I am having a problem with Windows. When I am using
CopyFileEx()
for example, if there is a problem it will pop up a modal dialogue, and the user will have to press some buttons to get rid of it. I want to handle the errors myself, in my programs, to make it less annoying.
Is there any way to disable those modal windows?
I noticed that if I start my application from a debugger (Insight) it will not display those messages.
Thanks in advance!
P.S. The language I am using is plain C.
You might want the SetErrorMode function.
For a Windows file manager SHFileOperation() is possible a better fit than CopyFileEx(). This will result in the native sheall dialogs for progress, conflict resolution etc. The levels of progress and error reporting can all be controlled.
Edit: In addition to the bounty, we're willing to pay $250 to have this bug fixed in the Firefox/Gecko codebase. Here is a simple test project (Visual Studio 2008 C#) that reproduces the problem.
Edit #2 we're willing to pay $600 to have this bug fixed. See above for sample project that reproduces the problem.
We have a Firefox (Gecko) ActiveX control on our C# Windows Form to display HTML.
When this Firefox ActiveX control is on our form, about 2-3% of our key presses don't make it through. Or rather, a different Windows message is sent:
We hold down the TAB key to tab through 3 regular WinForms text boxes. It will behave correctly 97% of the time. Spy++ tells us WM_KEYDOWN message is sent properly:
normal behavior http://judahhimango.com/images/normaltab.jpg
But randomly, maybe 2-3% of the time, the tab key (or other key) isn't processed right. Spy++ tells us WM_CHAR is being sent instead:
odd behavior http://judahhimango.com/images/screwytab.png
When the odd behavior occurs, either the key is not processed at all, or is processed incorrectly (such as inserting a '\t' character into a textbox that doesn't support tab characters.
This only occurs if the Firefox ActiveX control is on our form.
Our question is: does Firefox/Gecko engine install some kind of keyboard hook that might cause these side effects? Or better yet, how do we fix this problem?
The WM_CHAR message is generated by TranslateMessage call, so a good place to start looking would be the TranslateMessage calls in the Gecko source code.
In the first example code you provided the function is imported only by two libraries - mozctl.dll and xul.dll. Since you claim that the same error happens also with GeckoFX we can take mozctl.dll out of the equation. That leaves us with xul.dll, so given the Gecko source code I would suggest to look into widget\src\windows\nsToolkit.cpp. I am not sure if the code is run if the engine is embedded, but if it is then the library starts a whole new message pump in different thread, which is bound to break.
Unfortunately I can't run or compile the code on my machine (Windows 7 x64 w/o the Mozilla ActiveX control installed), so I can't verify any of this with a debugger. Hope it helps someone to track it down further.
The root problem is that when Mozilla is embedded in another application, it incorrectly pumps Windows messages when it dispatches internal events. Mozilla uses an event system to coordinate across threads or to schedule deferred processing on a thread (see nsIThread, nsIEventTarget). If you embed a web page with a lot of active XMLHTTPRequests, for example, Mozilla will use its event dispatching interface to dispatch events back to javascript and it will pump windows messages as a side effect. Once Mozilla events are fully dispatched, it goes back to the main event loop.
When Mozilla pumps windows messages, it doesn't include the extra processing done by the application's event loop - IsDialogMessage(), TranslateMessage(), PreTranslateMessage(), or any other pre-processing are skipped when Mozilla gets into this state. Symptoms therefore include tab key presses getting inserted as a character instead of being used for dialog navigation, keyboard hotkeys being sporadically ignored, or custom message pre-processing being sporadically skipped. For example, the Outlook 2007/2010 "Compose" screen sporadically loses keystrokes because it relies on custom message pre-processing to handle keyboard input.
See https://bugzilla.mozilla.org/show_bug.cgi?id=582790 for a patch that addresses the problem.
I have Snoop Free and PSM Anti-Keylogger.
One of them detected firefox trying to install a Keyboard Hook.
Mozilla/Firefox file xul.dll attempt at installing at keyboard hook.
DENIED.
I noticed that you have implemented all of the interoperability yourself. Can you try this with the GeckoFX project and see if you get the same error? I use this project at work and haven't encountered any issues yet.