Re: Meson issue with -L--export-dynamic flag
For anyone that wants to try to reproduce it, you can clone this repo and switch to the meson branch: https://github.com/bilelmoussaoui/tilix
Meson issue with -L--export-dynamic flag
Myself and some others are looking at replacing autotools in Tilix with meson for the various Linux distros to use when building and packaging the binary. However we are running into an issue with meson around the use of the "-L--export-dynamic" flag. When compiling with meson using LDC and that flag the following errors are generated: [66/66] Linking target tilix. FAILED: tilix ldc -of tilix 'tilix@exe/source_secretc_secrettypes.d.o' 'tilix@exe/source_secretc_secret.d.o' 'tilix@exe/source_app.d.o' 'tilix@exe/source_x11_X.d.o' 'tilix@exe/source_x11_Xlib.d.o' 'tilix@exe/source_secret_SchemaAttribute.d.o' 'tilix@exe/source_secret_Item.d.o' 'tilix@exe/source_secret_Schema.d.o' 'tilix@exe/source_secret_Service.d.o' 'tilix@exe/source_secret_Prompt.d.o' 'tilix@exe/source_secret_Collection.d.o' 'tilix@exe/source_secret_Secret.d.o' 'tilix@exe/source_secret_Value.d.o' 'tilix@exe/source_gx_util_array.d.o' 'tilix@exe/source_gx_util_path.d.o' 'tilix@exe/source_gx_util_string.d.o' 'tilix@exe/source_gx_gtk_cairo.d.o' 'tilix@exe/source_gx_gtk_clipboard.d.o' 'tilix@exe/source_gx_gtk_x11.d.o' 'tilix@exe/source_gx_gtk_resource.d.o' 'tilix@exe/source_gx_gtk_vte.d.o' 'tilix@exe/source_gx_gtk_actions.d.o' 'tilix@exe/source_gx_gtk_threads.d.o' 'tilix@exe/source_gx_gtk_dialog.d.o' 'tilix@exe/source_gx_gtk_settings.d.o' 'tilix@exe/source_gx_gtk_util.d.o' 'tilix@exe/source_gx_gtk_color.d.o' 'tilix@exe/source_gx_tilix_appwindow.d.o' 'tilix@exe/source_gx_tilix_terminal_advpaste.d.o' 'tilix@exe/source_gx_tilix_terminal_search.d.o' 'tilix@exe/source_gx_tilix_terminal_regex.d.o' 'tilix@exe/source_gx_tilix_terminal_actions.d.o' 'tilix@exe/source_gx_tilix_terminal_activeprocess.d.o' 'tilix@exe/source_gx_tilix_terminal_terminal.d.o' 'tilix@exe/source_gx_tilix_terminal_layout.d.o' 'tilix@exe/source_gx_tilix_terminal_password.d.o' 'tilix@exe/source_gx_tilix_terminal_util.d.o' 'tilix@exe/source_gx_tilix_terminal_exvte.d.o' 'tilix@exe/source_gx_tilix_terminal_monitor.d.o' 'tilix@exe/source_gx_tilix_sidebar.d.o' 'tilix@exe/source_gx_tilix_customtitle.d.o' 'tilix@exe/source_gx_tilix_prefeditor_bookmarkeditor.d.o' 'tilix@exe/source_gx_tilix_prefeditor_profileeditor.d.o' 'tilix@exe/source_gx_tilix_prefeditor_common.d.o' 'tilix@exe/source_gx_tilix_prefeditor_prefdialog.d.o' 'tilix@exe/source_gx_tilix_prefeditor_titleeditor.d.o' 'tilix@exe/source_gx_tilix_prefeditor_advdialog.d.o' 'tilix@exe/source_gx_tilix_preferences.d.o' 'tilix@exe/source_gx_tilix_application.d.o' 'tilix@exe/source_gx_tilix_shortcuts.d.o' 'tilix@exe/source_gx_tilix_colorschemes.d.o' 'tilix@exe/source_gx_tilix_session.d.o' 'tilix@exe/source_gx_tilix_constants.d.o' 'tilix@exe/source_gx_tilix_common.d.o' 'tilix@exe/source_gx_tilix_cmdparams.d.o' 'tilix@exe/source_gx_tilix_encoding.d.o' 'tilix@exe/source_gx_tilix_closedialog.d.o' 'tilix@exe/source_gx_tilix_bookmark_manager.d.o' 'tilix@exe/source_gx_tilix_bookmark_bmchooser.d.o' 'tilix@exe/source_gx_tilix_bookmark_bmeditor.d.o' 'tilix@exe/source_gx_tilix_bookmark_bmtreeview.d.o' 'tilix@exe/source_gx_i18n_l10n.d.o' -L-L/usr/lib// -L-lgtkd-3 -L-ldl -L-lvted-3 -L-L/usr/lib// -L-lgtkd-3 -L-ldl -L-lX11 /usr/bin/ld: tilix@exe/source_gx_tilix_appwindow.d.o: in function `_D2gx5tilix6common__T12GenericEventTCQBjQBj7session7SessionZQBn11__xopEqualsFKxSQDaQDaQCx__TQCtTQCiZQDbKxQBaZb': /tmp/tilix/build/../source/gx/tilix/common.d:28: undefined reference to `_D6object__T8__equalsTxDFC2gx5tilix7session7SessionZvTxQBgZQBvFNaNbNiNfAxQByQfZb' /usr/bin/ld: tilix@exe/source_gx_tilix_terminal_terminal.d.o: in function `_D2gx5tilix6common__T12GenericEventTEQBjQBjQBg10ActionTypeTCQCgQCgQCd__T16CumulativeResultTbZQvZQCx11__xopEqualsFKxSQEkQEkQEh__TQEdTQDsTQCzZQEpKxQBeZb': /tmp/tilix/build/../source/gx/tilix/common.d:28: undefined reference to `_D6object__T8__equalsTxDFE2gx5tilix6common10ActionTypeCQBdQBdQBa__T16CumulativeResultTbZQvZvTxQCtZQDiFNaNbNiNfAxQDlQfZb' /usr/bin/ld: tilix@exe/source_gx_tilix_terminal_terminal.d.o: in function `_D2gx5tilix6common__T12GenericEventTAyaTQeTQhTQkZQBc11__xopEqualsFKxSQCpQCpQCm__TQCiTQBxTQCbTQCfTQCjZQDcKxQBmZb': /tmp/tilix/build/../source/gx/tilix/common.d:28: undefined reference to `_D6object__T8__equalsTxDFAyaQdQfQhZvTxQpZQBdFNaNbNiNfAxQBgQfZb' collect2: error: ld returned 1 exit status Error: /usr/bin/gcc failed with status: 1 ninja: build stopped: subcommand failed. Taking out the export-dynamic flag it all works fine. Unfortunately this flag is the default for the DMD compiler (which apparently exhibits the same behavior) as well as LDC on some distros like Arch. That flag looks pretty innocuous so I'm not sure why it is causing an issue. I could use some help from someone more experienced with the compiler to help understand what is going on and if there is an issue with tilix, meson or the compiler itself. A full discussion of the issue can be viewed here: https://github.com/gnunn1/tilix/issues/1502
Re: Create variable for RedBlackTree range
On Saturday, 28 April 2018 at 17:20:46 UTC, Jonathan M Davis wrote: On Saturday, April 28, 2018 16:36:41 Gerald via Digitalmars-d-learn wrote: [...] In general, you just use auto, but that's not going to work if you can't directly initialize the variable. In that case, the solution is typeof. e.g. something like typeof(prompPosition[]) range; [...] If you mean the interfaces from std.range.interfaces, I don't think that anything in Phobos uses them except for that module, and I expect that very little range-based code in general uses them. Ranges are almost always structs. There are rare cases where those interfaces make sense, but ranges in general don't use them. Rather, range-based code is almost always templated. - Jonathan M Davis Thanks for the quick reply and the pointer in the right direction, I ended up using the ReturnType template to make it work: ReturnType!(promptPosition.lowerBound) range;
Create variable for RedBlackTree range
What is the appropriate way to create a variable for the range returned by RedBlackTree lowerBound and upperBound. For example, given this code: ``` RedBlackTree!long promptPosition = redBlackTree!long(); long row = to!long(vte.getVadjustment().getValue()); RBRange!(RBNode!long*) range; if (direction < 0) { range = promptPosition.lowerBound(row); if (range.empty) result = lower; else result = range.back; } else { range = promptPosition.upperBound(row); if (range.empty) result = upper; else result = range.front(); } if (result >= lower) { vte.getVadjustment.setValue(to!double(result)); } else { promptPosition.remove(range); } ``` The second line where I declare the range variable as RBRange!(RBNode!long*) the compiler complains with the following warning: Deprecation: std.container.rbtree.RBRange(N) is not visible from module terminal Which makes sense since RBRange is a private struct. However I cannot use the normal range interfaces here either (ForwardRange, BiDirectionalRange, etc) since it complains about RBRange not being able to cast to them.
Re: DUB and Gtk-d reduce size of huge executable, build dynamic dependencies
On Wednesday, 7 March 2018 at 10:51:49 UTC, CSim wrote: Hi, I'm trying to decide whether it is better to use DLang for Gtk development or Vala/Genie. When I make a simple Vala/Genie Gtk executable the file is tiny whereas the DLang file is huge. First I used the default Dub build and the file was in excess of 60mb (assuming this includes debug build). Using dub build=release the file is still more than 7 mb. Using a native Vala/Genie build the file is less than 500k. Trying to understand what is going on, but I assume from this that Dub is linking static dependencies, whereas the Vala/Genie builds will link to dynamic libraries. So my (two pronged) question is this: Is there any way to specify in dub.json to build and link dependencies as dynamic libraries, and are there any other tips that can be used to reduce these (relatively) huge executables? Personally, I do not worry too much about the executable size, however a couple of tips as follows: a. If this is on linux use "strip" to remove symbols out of the executable b. In dub.json you can specify just the portions of GtkD that your application depends on, i.e.: "dependencies": { "gtk-d:gtkd": { "version": "3.7.5" }, "gtk-d:vte": { "version": "3.7.5" } } Is what I use in tilix (https://github.com/gnunn1/tilix) c. You can dynamically link to GtkD, in tilix I have the config below to do so. Interestingly on ldc it doesn't make any difference in size though using ldd I can see the dependency to GtkD. With DMD it is smaller however I cannpt run it since the Arch Linux GtkD package is compiled with ldc2. { "name": "dynamic", "targetType": "executable", "libs": ["gtkd-3"], "libs-linux": ["X11"], "lflags": ["-defaultlib=libgtkd-3.so"], "versions": ["StdLoggerDisableTrace"] }
Re: gtk: get property
On Saturday, 5 August 2017 at 15:08:21 UTC, Johnson Jones wrote: I am trying to get the handle size of panned. Not sure if I'm doing it right but [...] I'm using this in Tilix: Value handleSize = new Value(0); paned.styleGetProperty("handle-size", handleSize);
Re: Fix gtkD api display
On Friday, 4 August 2017 at 21:54:26 UTC, Johnson Jones wrote: On Friday, 4 August 2017 at 15:24:51 UTC, Gerald wrote: On Friday, 4 August 2017 at 15:08:27 UTC, Mike Wey wrote: [...] Mike I had contributed the makeddox.sh script awhile ago, it generates much nicer documentation then candydocs in my IHMO and includes a nice search box. If there is something lacking in it that needs to be improved before it can be used let me know and I'll do the work. The only issue with it that I am aware of is you need to manually copy the public ddox css into the generated folder. I didn't see an easy way to determine it's location automatically. Is there any online demo of it working? Unfortunately there is not, I just run it locally on my laptop.
Re: Fix gtkD api display
On Friday, 4 August 2017 at 15:08:27 UTC, Mike Wey wrote: Improving the documentation is something i want to do but there are always some more important things to do. Like the Questions/Issues you posted earlier. So unless somebody volunteers it won't happen anytime soon. Mike I had contributed the makeddox.sh script awhile ago, it generates much nicer documentation then candydocs in my IHMO and includes a nice search box. If there is something lacking in it that needs to be improved before it can be used let me know and I'll do the work. The only issue with it that I am aware of is you need to manually copy the public ddox css into the generated folder. I didn't see an easy way to determine it's location automatically.
Re: Fiber based UI-Toolkit
On Monday, 10 July 2017 at 14:03:59 UTC, Jacob Carlborg wrote: On 2017-07-10 15:37, Gerald wrote: Having said that, I'm in the camp where this doesn't make much sense. Using fibers on the main UI thread is likely going to result in a blocked UI whenever a fiber takes too long to do its work. History has shown that cooperative multi-tasking typically doesn't work well for UI applications. It's that basically the whole idea of async/await? Seems like Microsoft is pushing quite heavily for that in GUI code. Thanks for the link, I'm not active with .Net so I had to go look it up. Reminds me a lot of the way node.js works. If all your async activity is IO bound maybe it works fine and I'm wrong about this. My past experience has been that it's challenging to determine the appropriate times to yield particularly with a lot of async activity happening. However with it baked into the framework and a simplified API maybe it becomes less of an issue. I'll have to do more reading on it, again thanks for the pointer.
Re: Fiber based UI-Toolkit
On Sunday, 9 July 2017 at 19:43:14 UTC, Christian Köstlin wrote: I wonder if there is any fiber based / fiber compatible UI-Toolkit out for dlang. The second question is, if it would make sense at all to have such a thing? As previously noted, like other UI toolkits GTK maintains a single thread for processing UI events with an event loop running in that thread. GTK does support passing a function to be called when the main loop is idle, it could be possible to leverage this to manage fibers with appropriate yielding. Having said that, I'm in the camp where this doesn't make much sense. Using fibers on the main UI thread is likely going to result in a blocked UI whenever a fiber takes too long to do its work. History has shown that cooperative multi-tasking typically doesn't work well for UI applications. I think you would be much better off starting an additional thread and managing fibers in that thread outside the context of the main UI thread. You can then use things like std.concurrency to receive messages from the external thread to update the UI as needed in it's own thread.
Re: Hosting vibe.d on OpenShift
On Saturday, 10 December 2016 at 17:54:58 UTC, aberba wrote: On Thursday, 8 December 2016 at 20:37:23 UTC, Tiberiu Gal wrote: On Thursday, 8 December 2016 at 14:03:35 UTC, aberba wrote: I would like to try vibe.d with mongoDB on OpenShit. I managed to do that on Heroku. Do I need a buildpack like vibe.d? Any help will be really appreciated. I've tried to create a vibe cartridge but cannot because of memory limitations. The easiest way: You should build locally and deploy the executable Aawsh!! Cartridges are for OpenShift v2 and earlier, I would highly recommend trying OpenShift v3 instead. OpenShift v3 switched to using Docker (as well as Kubernetes) so if there is a vibe.d docker package or you can get it packaged in docker yourself it should run in OpenShift just fine. Note that v3 is in developer preview for Online, however I'd suggest using either Red Hat's CDK (https://developers.redhat.com/products/cdk/overview/) or Minishift (https://github.com/minishift/minishift) as an easy way to play around with it.
Pass RegexMatch to a function?
I have a RegexMatch that I want to pass to a function that takes the match and replaces various tokens in a string with the match and/or individual groups of the match. I'm struggling to figure out how to pass a RegexMatch to a function, right now I have code like the follows: RegexMatch regexMatch = matchAll(urlMatch.match, regex(tr.pattern, tr.caseless?"i":"")); string command = replaceMatchTokens(urlMatch.match, regexMatch); ... string replaceMatchTokens(string tokenizedText, ref RegexMatch match) { string result = tokenizedText.replace("$0", match.match); int i = 0; foreach(group; match.captures) { result = result.replace("$" ~ to!string(i), group); i++; } return result; } When I try to compile this, it fails with the follow on the line where replaceMatchTokens is declared: Error: struct std.regex.RegexMatch(R, alias Engine = ThompsonMatcher) if (isSomeString!R) is used as a type I've also tried declaring it as follows: string replaceMatchTokens(string tokenizedText, ref RegexMatch!(string, ThompsonMatcher) match) { With the following errors: source/gx/terminix/terminal/terminal.d(1273,28): Error: struct std.regex.RegexMatch(R, alias Engine = ThompsonMatcher) if (isSomeString!R) is used as a type source/gx/terminix/terminal/terminal.d(2701,54): Error: template std.regex.match cannot deduce function from argument types !()(RegexMatch!(string, ThompsonMatcher)), candidates are: /usr/include/dlang/dmd/std/regex/package.d(777,13): std.regex.match(R, RegEx)(R input, RegEx re) if (isSomeString!R && is(RegEx == Regex!(BasicElementOf!R))) /usr/include/dlang/dmd/std/regex/package.d(785,13): std.regex.match(R, String)(R input, String re) if (isSomeString!R && isSomeString!String) /usr/include/dlang/dmd/std/regex/package.d(792,13): std.regex.match(R, RegEx)(R input, RegEx re) if (isSomeString!R && is(RegEx == StaticRegex!(BasicElementOf!R)))
Re: GTKD - CSS class color "flash" delay
On Friday, 24 June 2016 at 12:38:37 UTC, TheDGuy wrote: The color changing part works fine but if i use some kind of delay the program just starts delayed but no color changing happens. I am wondering why, because everything is executed in one thread, so the execution order looks like this to me: 1. Start GUI 2. Change Button Color to flash color 3. Wait 2 sec 4. Change Button Color back to standard Everything in GTK runs in the same thread, if your delay is a blocking one (i.e. putting the thread to sleep for 2 seconds) none of the GTK events will fire to redraw the button since the thread is occupied with your delay. I hope i can get around it without getting into multithreading? Other then the obvious multi-threaded, using glib.Timeout to trigger the reversion of the color change could be an option. http://api.gtkd.org/src/glib/Timeout.html
Re: GTKD - get CSS class for button
On Wednesday, 22 June 2016 at 12:57:51 UTC, TheDGuy wrote: widget.getStyleContext().listClasses() to get a list of all classes assigned to the widget. If you just want to see if a specific class is assigned to the widget you can use widget.getStyleContext().hasClass() Thanks a lot for your answer. Do you know how i can get the first classname as string from the widget? I don't understand how the return type 'GList' is organized. ListG has a D specific method called toArray that allows you to convert it to a typed array, so you could use it in this case to get a string[] out of it. http://api.gtkd.org/src/glib/ListG.html
Re: GTKD - get CSS class for button
On Wednesday, 22 June 2016 at 08:08:20 UTC, TheDGuy wrote: Hello, i would like to know if it possible to get the CSS-class which is asigned to a button (for example)? I didn't find any documentation about this, just the function "getStyleContext().getProperty()", my current attempt: Value value; bArr[0].getStyleContext().getProperty("Class",StateFlags.NORMAL,value); (bArr is an array of buttons). I get the error, that 'Value' is not defined, if i use 'GValue' (as it is described here: https://developer.gnome.org/gtk3/stable/GtkStyleContext.html#gtk-style-context-get-property) i get 'function is not callable with GValue' Any ideas? Thanks alot! widget.getStyleContext().listClasses() to get a list of all classes assigned to the widget. If you just want to see if a specific class is assigned to the widget you can use widget.getStyleContext().hasClass()
Re: GTKD - overrideBackgroundColor of Button doesn't work
On Thursday, 16 June 2016 at 07:58:56 UTC, TheDGuy wrote: On Wednesday, 15 June 2016 at 22:34:05 UTC, Gerald wrote: snip... The text color is green but the button background color is still default-gray! I don't see an obvious issue with your code, I usually use CSS classes personally and I know that works fine because I use this technique all over terminix. I would suggest using the GTK Inspector to debug the CSS issue, it's an awesome tool for figuring out GTK CSS issues as it let's you change CSS on the fly, see what CSS is being applied to an object, etc. You can see how to use it at the link below: https://wiki.gnome.org/Projects/GTK%2B/Inspector Do you know if this works on windows? No idea, I don't use Windows. Personally I just add and remove classes as needed: getStyleContext().addClass() getStyleContext().removeClass() So you basically have to create 2 classes? And what would you do if you would have to change the color randomly (for a simon says game)? I still think it is a bad idea to claim the way with function calls as deprecated but introducing a new system which is not as flexible (but maybe more powerfull). C# with Visual Studio does it, PyQT does it: Function calls. It can be done fine with on the fly changes, i.e. random colors, it's somewhat more work then just calling a simple function call but CSS gives you a lot more power as well. I do this in Terminix where for certain themes I want to set the scrollbar background to be the same color as the terminal background. Essentially, add a class to the widget and then construct the CSS for the class with your random background color as a string. Create a CSSProvider and use loadFromData, same as captaindet's example, to load the CSS in the string. Finally, use the widget's style context to add the CSS provider which you just constructed. If you want to change the color, remove that provider and add a new one.
Re: GTKD - overrideBackgroundColor of Button doesn't work
On Wednesday, 15 June 2016 at 21:39:37 UTC, TheDGuy wrote: On Wednesday, 15 June 2016 at 20:49:02 UTC, Gerald wrote: On Wednesday, 15 June 2016 at 09:03:45 UTC, TheDGuy wrote: Hello, why does this code not work? RGBA rgb = new RGBA(1,0.5,0.5,1.0); Button btn_1 = new Button("Start"); btn_1.overrideBackgroundColor(StateFlags.NORMAL, rgb); The color of btn_1 just doesn't change. https://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-override-background-color snip... The text color is green but the button background color is still default-gray! I don't see an obvious issue with your code, I usually use CSS classes personally and I know that works fine because I use this technique all over terminix. I would suggest using the GTK Inspector to debug the CSS issue, it's an awesome tool for figuring out GTK CSS issues as it let's you change CSS on the fly, see what CSS is being applied to an object, etc. You can see how to use it at the link below: https://wiki.gnome.org/Projects/GTK%2B/Inspector I am also wondering how it is possible to change the button color at runtime? In my opinion i don't think that CSS-based style has alot of advantages over the commonly used object functions. Personally I just add and remove classes as needed: getStyleContext().addClass() getStyleContext().removeClass()
Re: GTKD - overrideBackgroundColor of Button doesn't work
On Wednesday, 15 June 2016 at 09:03:45 UTC, TheDGuy wrote: Hello, why does this code not work? RGBA rgb = new RGBA(1,0.5,0.5,1.0); Button btn_1 = new Button("Start"); btn_1.overrideBackgroundColor(StateFlags.NORMAL, rgb); The color of btn_1 just doesn't change. https://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-override-background-color
Re: Which application is much suited and which is not.
On Saturday, 16 April 2016 at 14:08:05 UTC, newB wrote: Let's say you have decided to use D programming language. For what kind of applications would you choose D programming language and For what kind of applications you won't choose D programming. I might be in the minority opinion here but personally I wouldn't use D for enterprise applications in a Fortune 500 type environment unless there was a significant order of magnitude advantage to doing so (i.e. some niche that D really shines in compared to Java/C#). I'd say this for the following reasons: a. Eco-system. D is a great language but it's eco-system of libraries is very weak compared to more mature stacks, integration in a heterogeneous enterprise environment is not going to be D's forte. b. Talent availability. Java/C# developers are easy to find, D not so much
Re: Where do I learn to use GtkD
On Monday, 14 March 2016 at 07:38:43 UTC, Russel Winder wrote: What we need here is a collection of people reviewing each others GtkD code and having a listing board somewhere on the GtkD site of all the codes available and what they show. It is the annotations as much as the code itself that is needed for learning. Without comparative review, we may end up propagating bad code and bad GTK use. So rather than just email as here, we should be looking to create a "living document" on the wiki – not an historical type thing but an always up-to-date, curated document. I have some generic GtkD code in Terminix of varying quality that at some point in the future I want to move to a library in order to re-use it between my projects. This code mostly consists of helpers or things that make working with GtkD more D'ish, i.e enabling the use of foreach to iterate over a TreeModel/TreeIter. Having said that, I don't have the time to take on the role of being the primary maintainer for such a library, if you want to take it on though I'm happy to be an active contributor.
Re: Where do I learn to use GtkD
On Sunday, 13 March 2016 at 19:53:35 UTC, karabuta wrote: On Sunday, 13 March 2016 at 19:34:36 UTC, WebFreak001 wrote: and in the (not quite complete) documentation you can find widgets you might want to use. Its a great place for getting ideas on which widgets to use imo. http://api.gtkd.org/src/gtk/AboutDialog.html That thing really need some work to make it consumable :) I contributed a script (makeddocs.sh) to generate the documentation in ddox instead of candydocs, ddox is miles better then candydocs and using it is way more efficient IMHO.
Re: Where do I learn to use GtkD
On Sunday, 13 March 2016 at 19:28:57 UTC, karabuta wrote: Any help on where I can get better leaning materials(GtkD)? Repo, blogs post, etc please I starting learning both D and GTK back in October, I found that a combination of looking at an example D GtkD app, Grestful (https://github.com/Gert-dev/grestful), as well as examples in other languages worked fine for me. I started with a simple program as a learning example and then moved up from there. I'm still learning every day but it's coming along. I know you are already aware of Terminix but I have another, simpler app at https://github.com/gnunn1/vgrep as well. Finally, I have some entries on my blog about using GtkD based on my experiences, you can check them out at http://www.gexperts.com.
Re: Status icon on Linux
On Saturday, 20 February 2016 at 11:36:11 UTC, Mike Wey wrote: The documentation states we should use notifications, that means i'll probably need to add libnotify bindings to GtkD. Though sending notifications using DBus is also possible. (https://developer.gnome.org/notification-spec/) Depending on the use case using notifications might or might not be useful. Would the support for libnotify be for those applications not using gtk.Application since it already supports sending notifications via sendNotification. I'm using it in Terminix and it works quite well.
Re: How would you implement this in D? (signals & slots)
On Monday, 1 February 2016 at 21:44:28 UTC, Enjoys Math wrote: On Monday, 1 February 2016 at 21:40:45 UTC, Enjoys Math wrote: module signals_and_slots; import std.algorithm: remove; [...] D's signals & slots: https://dlang.org/phobos/std_signals.html I looked at that and perhaps I'm not reading the exampes correctly but I'm not sure how useful std.signals is in the real world. If you have a bunch of slots which take the same parameter types, not unusual in the GUI world, how would that work? The other thing that bugs me is lack of naming for slots and signals, again in the GUI world where you typically have dozens of these on an an individual widget differentiation is quite important. For my GtkD app where I need my own events between components outside of the built-in GTK ones I've just been rolling my own by hand using delegates similar to your example. It's pretty trivial but admittingly there is a bunch of boilerplate I'd love to eliminate via templates if there is a way to address the weaknesses with std.signals.
Re: How would you implement this in D? (signals & slots)
On Tuesday, 2 February 2016 at 15:59:06 UTC, Atila Neves wrote: Slots are named: the methods are slots. Signals can be named if you use only one struct as the parameter, as above. The signals would be String1 and String2, the slots watch1 and watch2. What I meant is that the connect call didn't seem to tie you to a specific slot, it looked like it determined the slot based on the types which is potentially error prone. Kagamin showed an example of explicitly connecting to a named slot so I'm happy with that, I'm looking forward to re-writing my event handlers using this technique. Always nice to learn something new.
Re: How do you draw in gtkD? Simple example overriding Widget.draw() doesn't compile.
Generally don't override methods in GtkD, use event handlers like addOnDraw. Because GtkD wraps GTK functions an overriden D method of GtkD will never get called by GTK since it is working with the underlying C functions directly.
Re: GTKD - Write Pixbuf back to context
https://developer.gnome.org/gtkmm-tutorial/stable/sec-draw-images.html.en Does this work for you?
Re: Threading to prevent GUI Freeze
On Monday, 4 January 2016 at 18:04:34 UTC, TheDGuy wrote: On Monday, 4 January 2016 at 17:33:28 UTC, Gerald wrote: On Monday, 4 January 2016 at 16:13:50 UTC, TheDGuy wrote: [...] Yes, you need it. The extern (C) function is what GDK invokes on idle. In any GUI application there is a lot of idle time waiting for events, what the addThreadIdle allows you to do is take advantage of this and tell GTK that whenever it's sitting around doing nothing, give this function a call. [...] Okay, thanks alot for your help. I think i will need some time to understand this but one last question: Do the errors come from the fact at i didn't use those GTK thread mechanisms or that my function is not "spawnable"? "std.concurrency.spawn(F, T...)(F fn, T args) if(isSpawnable!(F,T))" "Error: template std.concurrency.spawn cannot deduce function from argument types!()(void delegate(Context cr, Widget widget), Scoped Widget), candidates are:" Keep in mind I know nothing about Cairo and I don't have time to try your code, but what happens if you remove the Scoped template from the Context parameter? Also, have you checked if Cairo is thread-safe the way you are using it in the spawned function? I'm not sure if Cairo has the same restrictions that GTK widgets do.
Re: Threading to prevent GUI Freeze
On Monday, 4 January 2016 at 15:28:56 UTC, TheDGuy wrote: On Monday, 4 January 2016 at 15:07:12 UTC, Luis wrote: On Monday, 4 January 2016 at 14:31:04 UTC, TheDGuy wrote: [...] Before doing anything with threads and GTK, you should read this : http://blogs.operationaldynamics.com/andrew/software/gnome-desktop/gtk-thread-awareness Okay, so i have to do it like this on every function i use from GTKD? threadsInit(); threadsEnter(); GtkAllocation size; widget.getAllocation(size); threadsLeave(); I wrote a demo for GtkD showing how multi-threading and D work together, it's in the demos/gtkD/DemoMultithread folder of GtkD, hopefully it will be helpful. However this example it is based on using the GTk threadIdle callback which is generally preferred over the locking methods you show above, obviously though your use case may vary but keep in mind the locking methods have been deprecated, see the GTK 3 reference manual here: https://developer.gnome.org/gdk3/stable/gdk3-Threads.html You also see this GtkD issue here for https://github.com/gtkd-developers/GtkD/issues/137 for some code on how to use Delgates with gdk_threads_add_idle (i.e. GtkD gdk.Threads.threadsAddIdle).
Re: Threading to prevent GUI Freeze
On Monday, 4 January 2016 at 16:13:50 UTC, TheDGuy wrote: Thanks for your example code. Do i need those extern (C) function? Yes, you need it. The extern (C) function is what GDK invokes on idle. In any GUI application there is a lot of idle time waiting for events, what the addThreadIdle allows you to do is take advantage of this and tell GTK that whenever it's sitting around doing nothing, give this function a call. The idea is that you spawn a thread that does your work and when GTK invokes your thread idle callback where you can check the status of the thread and update the UI accordingly. For example, let's say you need to render a highly complicated graph that takes a few minutes to complete. You could spawn a thread that renders it into an off-line buffer of some sort and once completed sends a message to the GTK main thread using std.concurrency. At some point GTK calls your thread idle callback and you simply invoke the std.concurrency.receive and see a message saying the graph has been rendered is available, and if so, copy it into the appropriate GTK widget. The important thing to understand is that the thread idle callback happens in the GTK main thread so it is completely safe to update GTK widgets from here. The other thing to understand is that whatever you work you do in the callback must be short, if you don't return in a reasonable amount of time you are blocking the main GTK thread. As a result it really should only be used as a mechanism to track work progress in whatever threads you have spawned. The GTK thread idle callback works beautifully with D's std.concurrency send and receive mechanism. Note the code I pointed you to in that D github Issue abstracts the extern (C) function from you and allows you to use normal D delegates as callbacks. The issue was created to get this incorporated into GtkD as I agree the framework should abstract this. Why is it not possible to write the value to the TreeView in D? I don't understand what you mean as of course it's possible to update value's in a TreeView. Do you mean why am I updating it from the callback (i.e. the C function)? The code here is an artificial example where it is simply updating the treeview with an iterating number generated in a separate thread. The results being posted to the TreeView could just as easily be a resultset from a long running database query, a complicated mathematical expression, etc. Hopefully the previous explanation helps you understand what the callback is doing. You can see a more real world example of GtkD multi-threading in this application I wrote called Visual Grep (https://github.com/gnunn1/vgrep), it puts a GTK GUI around grep with all searches running in background threads and updating Gtk TreeView as results come in. It also uses the delegate code linked in that issue which originally came from an application called grestful. Note Visual Grep was my first ever D/GtkD program so there is some ugh code in there, but hopefully it can act as an additional source of info for you.
Re: Getting GtkD to work on OSX
On Saturday, 28 November 2015 at 10:26:58 UTC, Mike McKee wrote: I have GtkD working just fine on Ubuntu Linux. Now I'm trying to get it to work on my Mac with the same hello.d codebase and hello.glade file. (Demo here: http://stackoverflow.com/a/32535987/105539) What's the procedure to getting GtkD installed on OSX? I don't have OSX, but have you looked at the GtkD section on OSX? https://github.com/gtkd-developers/GtkD/wiki/Mac-OS-X-Notes
Re: Regex start/end position of match?
Thanks Adam, that was the hint I needed. For a given RegexMatch the pre().length() is essentially equivalent to the start position and taking pre().length + hit.length() gives the end position so I think this should be OK for my needs.
Regex start/end position of match?
I'm using the std.regex API as part of Linux GUI grep utility I'm trying to create. I've got the GUI going fine using gtkd, the code to iterate over files (wow that was succinct in D, very impressive!), and getting matches via regex using the matchAll function. I'm stuck though on how to get the start/end index of a match? Looking at RegexMatch, I don't see an obvious way to get this? I'll admit that coming from Java I'm not very comfortable with the Range concept in D, however I read the Range and Regex D documentation as well as Andrei's article on ranges referenced in the docs and I'm still not seeing what I'm missing. By comparison, the Java API includes the start/end match index in the MatchResult interface. I have a feeling I'm not grokking something fundamental about Ranges in D, what am I missing? BTW in case anyone asks, the reason I'm looking for this is to highlight the matches when displaying matching lines in the GUI.